1. Ignore escape characters
For example
String fileName = "D:\ text file \text.txt";
After using @
String fileName = @ "D: Text file \text.txt";
2. Let the string cross the line
For example
String strSQL = "SELECT * from HumanResources.Employee as E"
"INNER JOIN Person.Contact as C"
"On e.contactid = C.contactid"
"ORDER by C.lastname";
After using @
String strSQL = @ "SELECT * from HumanResources.Employee as E
INNER JOIN Person.Contact as C
On e.contactid = C.contactid
ORDER by C.lastname ";
3. Usage in identifiers
C # is not allowed to use the keyword as an identifier (class name, variable name, method name, tablespace name, etc.), but if you add @
For example
public static void @static (int @int)
{
if (@int > 0)
{
System.Console.WriteLine ("Positive Integer");
}
else if (@int = = 0)
{
System.Console.WriteLine ("Zero");
}
Else
{
System.Console.WriteLine ("negative Integer");
}
}
C # Holy Road Note--c# Programming @ 3 Kinds of functions