Verbatim Literals in ASP.Net and C#
Have you ever come up with standard where you wanted to access a path in a program.
Lets just say :
d:\binoy\jpeg\website\bro.jpg
If I want to print out the same using a c# code it would look something like as follows:
string path = ”d\\binoy\\jpeg\\website\\bro.jpg”
Console.WriteLine(path);
Now you can notice that every backslash is followed by another one to print the actual path.
There is another way of doing the it :
string path=@”d:\ binoy\jpeg\website\bro.jpg”
The use of the @ sign together with a regular literal is actually called a Verbatim Literal This Literal starts with @ sign and helps compiler to understand about the verbatim. This is really helpful when you are dealing with nested folder 20 times deeper.
Now you need not use the backslash sign to implement it. 🙂