I have C# code that creates HTML. One particular piece of code creates a long string which is no problem for the browser. However when I look at the code with view > source it's difficult to see what's happening.
Is there some way that I can insert a carriage return or new line into my string so that it will make the string continue on the next line.
Thanks,
You can put
\r\n
in your string.Along with
Environment.NewLine
and the literal\r\n
or just\n
you may also use a verbatim string in C#. These begin with@
and can have embedded newlines. The only thing to keep in mind is that"
needs to be escaped as""
. An example:So...
Produces...
New user:
Name: Name
Email: Email
Phone: Phone
myString += Environment.NewLine;