Tuesday, January 25, 2011

3 uses of the @ Symbol in c#

1. You can use one of the reserved words of c# with the @ symbol
Eg :
string @int = "senthil kumar";

or something like this

string @class ="MCA";

Although you can use this , avoid using one.

2. Before a string specially when using the file paths .
You can use

string filepath = @"D:\SENTHIL-DATA\myprofile.txt";

instead of

string filepath = "D:\\SENTHIL-DATA\\myprofile.txt";

3. For a Multi lined text

string ThreeIdiots = @"Senthil Kumar,

Norton Stanley,
and Pavan Rao!";
MessageBox.Show(ThreeIdiots);

Read more: Ginktage