问题
i'm getting // in path i want single /. whenever i'm debugging it i'm getting // at run time. i have also used replace method. but it isn't working. My code is
string inputFile =
Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName +
"\\InputFiles\\" + config.country + ".txt";
inputFile = inputFile.Replace(@"\\", @"\");
回答1:
You're getting \\
only in debug mode, because when visualizing the string literal the debugger is re-escaping it for the visualization purposes, however when operating with it, the string literal will contain only a single \
.
来源:https://stackoverflow.com/questions/50942390/replace-with-at-run-time