I have got the string:
string test = "\test.xml";
how can I print it out as: \test.xml
I have got the string:
string test = "\test.xml";
how can I print it out as: \test.xml
\
is an escape sequence character.
Escape Sequence -- Represents
\\ -- Backslash
If you want to use it in your string, you should escape it with another \
character.
string test = "\\test.xml";
or your can use verbatim string literal with @
character like;
string test = @"\test.xml";
Just add escape sequence as:
string test = "\\test.xml";
Better option is to prepend '@' to avoid all escape sequences from string as:
string test = @"\test.xml";
string test = @"\test.xml";
or
string test = "\\test.xml";