C# won't escape "\"? -
possible duplicate:
how use “\” in string without making escape sequence - c#?
why giving me error in c# when use string like: "\themes\default\layout.png"? @ "d" , "l" location? says unrecognized escape sequence. , how stop giving me error when use: "\"?
thans
you need escape additional \
:
string value = "\\themes\\default\\layout.png";
or use @
symbol:
string value = @"\themes\default\layout.png";
which avoid doubling \
.
or if dealing paths (which seems are) use path.combine method:
string value = path.combine(@"\", "themes", "default", "layout.jpg");
Comments
Post a Comment