|
Post by Admin on May 28, 2014 9:20:28 GMT -5
Escape Sequences in C# msdn.microsoft.com/en-us/library/h21280bw.aspxVerbatim Literal is a string with an @ symbol prefix, as in @“Hello". Verbatim literals make escape sequences translate as normal printable characters to enhance readability. Practical Example: Without Verbatim Literal : “C:\\Pragim\\DotNet\\Training\\Csharp” – Less Readable With Verbatim Literal : @“C:\Pragim\DotNet\Training\Csharp” – Better Readable Sample Code: using System; class Program { static void Main() { // string Name = "Bin"; // Console.WriteLine(Name); // Comment: Output double quotation mark \" // string Name = "\"Bin\""; // Console.WriteLine(Name);
// Comment: Output new line \n // string Name = "One\nTwo\nThree"; // Console.WriteLine(Name);
// Comment: Output backslash \\ // string Name = "C:\\Pragim\\Donet\\Training\\Csharp"; // Console.WriteLine(Name);
// Comment: Output Verbatim string Name = @"C:\Pragim\Donet\Training\Csharp"; Console.WriteLine(Name); } }
|
|