Console.WriteLine(@"hi");

  • Thread starter Thread starter Guest
  • Start date Start date
ae said:
what is the signficance of the @?


Hello ae,

That's a character that tells the compiler to interpret a string verbatim.
It turns a regular-string-literal into a verbatim-string-literal.

If the @ character isn't used, then any backslashes in the string must be
(prepended with a backslash) || (appended with an escape character.)

Here is an example (without/with):

.... "c:\\windows\\system32\\pschdcnt.h";
.... @"c:\windows\system32\pschdcnt.h";


Another use:

.... "Line1\nLine2\nLine3";
.... @"Line1
Line2
Line3"; // multiline goodness. -- jBuelna


J. Buelna - Houston, TX
 
Back
Top