what the result of the following strings:
@""""
@""","
I think:
""
",
Am I right?
Thank you
Printable View
what the result of the following strings:
@""""
@""","
I think:
""
",
Am I right?
Thank you
yes, you got
Code:" which is codable also as string s= "\"";
and
", which si codable aslo as string s2="\",";
Cimperiali,
so @"""" is "" or "
Thank you for your help
Normally (without using the @ symbol), when you type in ", it ends the string - so, to prevent this, you must use an escape sequence \" wherever you want " to appear as a part of the string.
Now, @ denotes verbatim strings, which ignore escape sequences and line breaks (useful for paths, for example). However, typing " still ends the string literal, and you can't use \" anymore, so a different approach is used - whenever you need " as a part of your string, you type in "".
So, @"""" is actually ".
This is something you can easily test yourself; just write a simple program that prints out a string variable, and then experiment a bit.
Code:// in Main()
string test = @""""; // change this string literal, then run again
Console.WriteLine(test);