what is this used for --> @
-
In some codes I saw @ character before string. I here that it is used in php sytax for breaking loops, but could not found any clue what it does in c#
karanba
Makes it so escape characters are skipped.
string x = "What now man? \nWe are going to the store";
Console.WriteLine(x);will output:
What now man?
We are going to the storewhereas this:
string x = @"What now man? \nWe are going to the store";
Console.WriteLine(x);will output:
What now man? \nWe are going to the store
-
Makes it so escape characters are skipped.
string x = "What now man? \nWe are going to the store";
Console.WriteLine(x);will output:
What now man?
We are going to the storewhereas this:
string x = @"What now man? \nWe are going to the store";
Console.WriteLine(x);will output:
What now man? \nWe are going to the store
-
In some codes I saw @ character before string. I here that it is used in php sytax for breaking loops, but could not found any clue what it does in c#
karanba
A @ delimited string has the double quote as only escape code. These declarations are equivalent: string a = "A string with \"quotes\" and a backslash: \\ in it."; string b = @"A string with ""quotes"" and a backslash: \ in it.";
--- b { font-weight: normal; }
-
A @ delimited string has the double quote as only escape code. These declarations are equivalent: string a = "A string with \"quotes\" and a backslash: \\ in it."; string b = @"A string with ""quotes"" and a backslash: \ in it.";
--- b { font-weight: normal; }
I also use it for creating multiline strings string sql = @" SELECT * FROM TABLE WHERE THIS=@THAT ";