meaning of strings prefixed with @ sign

  • Thread starter Thread starter Christian Blackburn
  • Start date Start date
C

Christian Blackburn

Hi Gang,

Does @ mean the working directory in strings?
strFile = @"\DoNotCallFilter\Setup.exe";

Does it change the way the string has to be escaped? Normally, I
would think you'd have to do strFile = "\\DoNotCallFilter\\Setup.exe";

Thanks,
Christian
 
Hi Gang,

I feel like a total dork, moments after I posted this I saw someone
had just asked that. It's a verbatim string literal and behaves more
like VB, my native language so that's groovy at least where file paths
are concerned.

Thanks,
Christian
 
Christian said:
Hi Gang,

I feel like a total dork, moments after I posted this I saw someone
had just asked that. It's a verbatim string literal and behaves more
like VB, my native language so that's groovy at least where file paths
are concerned.

Thanks,
Christian

It's even groovier than that. :) You can even have line breaks in a
literal string:

string xml =
@"<root>
<name>Peter Pan</name>
<address>Neverland 1</address>
</root>";
 
Back
Top