I recently stumbled upon a list of c# character escape sequences here.
Escape sequences are needed because certain characters have special meanings within a literal string (and so cannot be used directly). For example, a single quote would need to be written as follows:
So I took a quick look at the list to see which ones would be useful working within a basic data-bound Windows Phone app sample.
The following escape sequences all functioned the same (which was expected):
\f– Form feed
\n– New line
\r– Carriage return
I have been in the habit of using
\r\n in my apps for a new paragraph, but any combination of the above works.
The double quote escape sequence
\" did not work but this special character sequence works fine instead: "
The escape sequence that I liked the most was
\t which is used for a horizontal tab. I wish I had known about this one a while back.
The other interesting one is
\u for Unicode characters. With this you can, for example, open up Character Map, select any character and enter the four digit hex code for that character.
\u00E6 will display a Latin small letter Ae. Very useful!