I’m having trouble figuring out the correct syntax to integrate an emdash into a string in Razor. Here’s the idea:
@( string.IsNullOrEmpty(Model.DemandClassCode) ? string.Empty : Model.DemandClassCode — Model.DemandClassName)
I’m getting a ReSharper error message in the editor:
Cannot resolve symbol ‘mdash’
Razor automatically HTML encodes all the output which is not
HtmlString.Use
Html.Rawhelper if you don’t want encoding:Or create the
HtmlStringexplicitly:And with your new sample:
Or with using if: