Reputation: 73918
I use C#.
I need assign a value to a string as verbatim
.
Here my code:
string verbatim = "@<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">";
or
string verbatim = @"<META NAME=""ROBOTS"" CONTENT=""NOINDEX, NOFOLLOW"">";
But it does not work.
What I'm doing wrong here? Thanks
Upvotes: 2
Views: 209
Reputation: 2972
The @ must be outside the string and you need to use double quotes:
string verbatim = @"<META NAME=""ROBOTS"" CONTENT=""NOINDEX, NOFOLLOW"">";
Upvotes: 1
Reputation: 1062780
You mean a verbatim string literal? Double-up the internal quotes and move the @
:
string verbatim = @"<META NAME=""ROBOTS"" CONTENT=""NOINDEX, NOFOLLOW"">";
Upvotes: 4
Reputation: 10400
The @ charctaer goes outside the string ath beginning and you need to escape your quotes, i.e.
string verbatim = @"<META NAME=""ROBOTS"" CONTENT=""NOINDEX, NOFOLLOW"">"
Upvotes: 3