I was wondering if someone could give me a quick hand with this. I have a text box that a user types a directory location in. Obviously the directory path includes at least one "\" character and could contain many more.
Because the slash is the escape character and I want to use the path later on in the code, I need to replace the single "\" with "\\"
Here's what I did, and what the Immediate window reports:
string host = this.HostAddress.Text.Replace(@"\", @"\\");
Immediate reports host as:
"C:\\\\Program Files (x86)"
When it should report it as:
"C:\\Program Files (x86)"
the original text was:
"C:\Program Files (x86)"
Any thoughts?