When you prefix a string literal with the @ symbol, you have created what is termed a verbatim string. Using verbatim strings, you disable the processing of a literal’s escape characters and print out a string as is. This can be most useful when working with strings representing directory and network paths. Therefore, rather than making use of \escape characters, you can simply write the following:
Console.WriteLine(@"C:\MyApp\bin\Debug");
Also note that verbatim strings can be used to preserve white space for strings that flow over multiple lines.
string myLongString = @"This is a very
very
very
long string";
Console.WriteLine(myLongString);
Using verbatim strings, you can also directly insert a double quote into a literal string by doubling the "token.
Console.WriteLine(@"""");
Quick Notes for easy understanding. Chapters are on C#.Net,Linq,OOPS,Design Patterns,UML,Tools for development, Databases and many others. - Sid
Friday, November 22, 2013
Subscribe to:
Post Comments (Atom)
Code Formater
Paste Here Your Source Code | ||||||||||||||
Source Code Formatting Options | ||||||||||||||
|
||||||||||||||
Copy Formatted Source Code | ||||||||||||||
Preview Of Formatted Code |
No comments:
Post a Comment