In VS 14 if I type (in the C# Interactive window) for examle Environment.CurrentDirectory
it says "C:\\Users\\some.username"
. How can I get "C:\Users\some.username"
instead, without manually deleting characters?
Asked
Active
Viewed 385 times
2
-
1Possible duplicate of [How can I remove the escape characters from this string?](http://stackoverflow.com/questions/22289922/how-can-i-remove-the-escape-characters-from-this-string) – Dan Field Mar 08 '16 at 19:33
2 Answers
5
Use Console.WriteLine(value)
:
> Console.WriteLine(Environment.CurrentDirectory)
C:\Users\
>

Novakov
- 3,055
- 1
- 16
- 32
-
1It would, technicaly, be `Console.WriteLine($"\"{Environment.CurrentDirectory}\"")`. :) – Paulo Morgado Mar 08 '16 at 22:33
3
The debugger will show it as double slash but if you check the variable, it will be with the single slash. The debugger displays it as you would expect when escaping in C# code but the underlying value is what you would expect (i.e "C:\Users\some.username").

keyboardP
- 68,824
- 13
- 156
- 205
-
2
-
1That's true, my bad. Principle still stands, possibly because it's using the same display method as the debugger. – keyboardP Mar 09 '16 at 19:33