2

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?

svick
  • 236,525
  • 50
  • 385
  • 514
Test_me
  • 393
  • 4
  • 13
  • 1
    Possible 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 Answers2

5

Use Console.WriteLine(value):

> Console.WriteLine(Environment.CurrentDirectory)
C:\Users\
>
Novakov
  • 3,055
  • 1
  • 16
  • 32
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