Monday, May 22, 2006

Verbatim Symbol ( @ ) in C#


In C#,Verbatim (@) is the powerful string as ever.


It will take care of escape sequences.


Ex:


If you are going to assign a path value to some string

without verbatim,we need to specify the escape sequences.



string path = "C:\\log\\log.txt"


If we use verbatim,no need to take care of escape sequences.


string path = @"C:\log\log.txt"


It will used to supress the Keyword itself.



Ex:

if you are decalre the class as property name,

C# won't allow this coz of keyword.If you use

the verbatim (@),it is possible to suppress a keyword



public string @class
{
get{};
set{};
}


No comments: