Tuesday, 2 August 2016

Verbatim String

This are type of string which do not require to be escaped, like a filename:

string myFileName = "C:\\DotNet\\ReadMe.txt"; Can be replace with
string myFileName = @"C:\DotNet\ReadMe.txt";

The @ symbol means to read that string literally.

verbatim string can also have multi line.

String MultilineString = @" This is
                                           a multi line
                                          string which is span
                                          in 4 lines";

No comments:

Post a Comment