I want to define a long string and use it as a parameter in a helper class.
I have the following code which does not compile
@{
var code ="
new TEL_Helper
{
URI = "[email protected]",
Type = TEL_TelecomType.Email,
Use = TEL_TelecomUse.VacationHome
}"
Html.SyntaxXML(code)
}
How do I define the string that spans multiple lines and has line breaks.
and the solution I used was :
@{
var code =@"
new TEL_Helper
{
URI = '[email protected]',
Type = TEL_TelecomType.Email,
Use = TEL_TelecomUse.VacationHome
}";
Html.SyntaxXML(code);
}
You're looking for the standard C# verbatim string literal.
var code = @"
new TEL_Helper
{
URI = ""[email protected]"",
Type = TEL_TelecomType.Email,
Use = TEL_TelecomUse.VacationHome
}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With