locked
Why do we need @ RRS feed

  • Question

  • User403949901 posted

            bitmap1 = (Bitmap)Bitmap.FromFile(@"C:\Documents and Settings\All Users\Documents\My Music\music.bmp");

     when ever an image location is hardcoded , they use this symbol " @ ".

    Would someone like to tell me why it is so?

    Wednesday, January 3, 2007 8:15 PM

Answers

  • User-2041805088 posted

    Because it contains escape characters. You could also use:

    bitmap1 = (Bitmap)Bitmap.FromFile("C:\\Documents and Settings\\All Users\\Documents\\My Music\\music.bmp");

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 3, 2007 8:44 PM

All replies

  • User-2041805088 posted

    Because it contains escape characters. You could also use:

    bitmap1 = (Bitmap)Bitmap.FromFile("C:\\Documents and Settings\\All Users\\Documents\\My Music\\music.bmp");

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 3, 2007 8:44 PM
  • User1001868398 posted
    The character @ at the beging on a string tells the compiler to use it literal, so escape characters like \n will not apply, will display as there are
    Wednesday, January 3, 2007 8:45 PM
  • User403949901 posted
    Thanks for the quick reply[:D]
    Wednesday, January 3, 2007 8:48 PM