This project is read-only.

Verbatim vs. regular strings

Oct 5, 2011 at 8:51 PM

I noticed that StyleCop 4.5 regressed one of my rules. Further investigation revealed that the expression text for the following strings are now different:

string s1 = @"c:\temp\test.txt";
string s1 = "c:\\temp\\test.txt";

For s1, the expression.Text is "c:\temp\test.txt". For s2, it's "c:\\temp\\test.txt". I understand this might make sense, however what's the best way for me to check whether the string is verbatim? By checking if expression.Token.Text starts with "@"?

-- AFurtado