I have a messaging system that is a .NET 2 ASMX web service, very basic system. I push messages and would like to have newline symbols in the message so it’s formatted on the receiving end. For example, I’d like to send a string such as: “Hello\n\nMy Name Is…” and have it have two line breaks. When the receiver reads the text it’s actually outputting the \n’s in the text. How can I get the \n’s to be interpreted as if I was writing it in C#? Or \t etc.
Thank you.
You should compose the message using Environment.NewLine to insert the character(s) used to represent a newline on your system.
See here for references
However using Environment.NewLine has some problems.
For example, your message should be written in this way
a bit cumbersome to use from a programmer point of view.
Then you could write an extension method for the string class which takes your message and insert at the place of a placeholder the Environment.NewLine chars.
This example use the | (pipe) character as placeholder for the newline pos.
and you can call this extension in this way