A
verbatim string literal consists of an @ character followed by a string in
double quotes. The escape sequences in verbatim string literal are not
processed.
using System; class Program { static void Main(string[] args) { String withoutVerbatim = @"1\n2\n3\t4"; String withoutVerbatim = "1\n2\n3\t4"; Console.WriteLine(withVerbatim); Console.WriteLine("******************"); Console.WriteLine(withoutVerbatim ); } }
Output
1\n2\n3\t4 ****************** 1 2 3 4
As
you see the ouput, @ symbol don’t interpret the escape sequences \n, \t. Where
as the string withOutVerbatim interpreted \n as new line and \t as tab.
No comments:
Post a Comment