Re: CSharp @

Discussion in 'ASP .Net' started by Leon Mayne, Apr 17, 2008.

  1. Leon Mayne

    Leon Mayne Guest

    "David" <> wrote in message
    news:...
    > Hi,
    >
    > I know this isn't a C# group, but its just a quick one.
    >
    > As a seasoned C++ developer I'm learning C# as I go along. What's the @
    > symbol for before a string?
    >
    > eg:
    >
    > FileInfo myFile = new FileInfo(@"c:\Temp\Test\readme.txt");
    >
    > Why can't it just be:
    >
    > FileInfo myFile = new FileInfo("c:\Temp\Test\readme.txt"); ?


    Because it escapes all the characters in the string. It couldn't be the
    second example you gave, it would have to be:

    FileInfo myFile = new FileInfo("c:\\Temp\\Test\\readme.txt");
    Leon Mayne, Apr 17, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Piero Massari

    tool to make a class diagram from csharp

    Piero Massari, Jun 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    510
    Sahil Malik
    Jun 17, 2004
  2. Natty Gur
    Replies:
    0
    Views:
    409
    Natty Gur
    Jul 27, 2003
  3. CSDunn

    ASP.NET not processing CSharp code

    CSDunn, Jan 7, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    415
    CSDunn
    Jan 14, 2004
  4. Vili
    Replies:
    1
    Views:
    565
    Eric Cherng
    Jun 28, 2004
  5. John
    Replies:
    1
    Views:
    3,199
    Scott Allen
    Jul 26, 2004
Loading...

Share This Page