devrim nalbantoglu
devrim nalbantoglu

Reputation: 3

read a path from file in a correct syntax with streamreader

I'm completely a junior here. I have tried something like

Can anyone help me?

Upvotes: 0

Views: 60

Answers (1)

JonasH
JonasH

Reputation: 36371

I think you might be confusing string literals with a string.

Say I write var myString = "\\" or var myString = @"\", this will show in the debugger as \\, because the debugger will format it as a literal. But if print it to the console, a file, or press the magnifying glass next to the string in the debugger, it will be shown as \, because that is the actual string value. See also verbatim string literal

So, if you do myStreamWriter.Write("c:\\aaa\\bbb\\text.txt");, you will be actually saving the string c:\aaa\bbb\text.txt, and that is also the string that will be read back.

However I fail to understand why you would want three slashes, I can only assume the OP thinks the escaping is done multiple times.

Upvotes: 1

Related Questions