-1

I have to add a string with double "Hide "My Account" Button" in a C# MVC Model (.cs) file. When I am adding it directly as a string it throws an error. I am adding my code below, please chec it.

    [JsonProperty(PropertyName = "hidemyaccountbutton")]
    [Display(Name = "Hide "My Account" Button")]
Himanshu Joshi
  • 292
  • 2
  • 10

2 Answers2

0

You need to escape the quotes using the \ character. Example:

"The dog says \"Woof!\""
Paramecium13
  • 345
  • 1
  • 7
0

You can escape strings in C# using string verbatim like that:

[Display(Name = @"Hide ""My Account"" Button")]

or by escaping quote:

[Display(Name = "Hide \"My Account\" Button")]
romfir
  • 394
  • 3
  • 6