"Svt" <(E-Mail Removed)> wrote in news:6de501c343fd$6319adc0$(E-Mail Removed):
> Hello,
> I am creating web service to save file document and I
> need to specify <file path>. What is the correct syntax
> for it?
> It should be:
> string sFile = "<file path>";
> I tried:
> string sFile = "C:\MyDocuments\test_app.txt\";
> and I get an error: Unrecognized escape sequence.
A single backslash in a C# string is interpreted as an escape
sequence:
http://msdn.microsoft.com/library/en-
us/csspec/html/vclrfcsharpspec_2_4_4_5.asp
If you want C# to treat the backslash character as a literal, either
double up the backslash:
string sFile = "C:\\MyDocuments\\test_app.txt\\";
or prepend the string with the @ character:
string sFile = @"C:\MyDocuments\test_app.txt\";
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/