meaning of strings prefixed with @ sign

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christian Blackburn

    #1

    meaning of strings prefixed with @ sign

    Hi Gang,

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

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

    Thanks,
    Christian
  • Christian Blackburn

    #2
    Re: meaning of strings prefixed with @ sign

    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

    Comment

    • =?ISO-8859-1?Q?G=F6ran_Andersson?=

      #3
      Re: meaning of strings prefixed with @ sign

      Christian Blackburn wrote:
      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>Neverl and 1</address>
      </root>";

      --
      Göran Andersson
      _____
      Göran Anderssons privata hemsida.

      Comment

      Working...