Reputation: 23207
For some reason, the syntax highlighting below is working how I'd like it to, but this is not how it interprets the code in Visual Studio. When I try to assign multiple lines to a string, it won't let me. Is there a way i can make the following work without combining all of my code into one line or using a += for each new line?
string HtmlCode = "";
HtmlCode =
"
<head>
<style>
*{margin: 0px;padding: 0px;font-family: Microsoft Sans Serif;font-size: 11px;}
</style>
</head>
";
Upvotes: 1
Views: 184
Reputation: 2077
Prefix the string with an "@"
string HtmlCode = "";
HtmlCode =
@"
<head>
<style>
*{margin: 0px;padding: 0px;font-family: Microsoft Sans Serif;font-size: 11px;}
</style>
</head>
";
Upvotes: 2
Reputation: 11598
Use literal strings:
string HtmlCode = @"
<head>
<style>
*{margin: 0px;padding: 0px;font-family: Microsoft Sans Serif;font-size: 11px;}
</style>
</head>";
Upvotes: 2
Reputation: 50000
Use verbatim string by prefixing your string with @
string HtmlCode = "";
HtmlCode =
@"
<head>
<style>
*{margin: 0px;padding: 0px;font-family: Microsoft Sans Serif;font-size: 11px;}
</style>
</head>
";
Upvotes: 10