我有stringBuilder和string类,存储路径:
StringBuilder name = new StringBuilder();
name.Append(@"NETWORK\MyComputer");
String serverName = name.ToString(); //this converts the \ to a \\
Run Code Online (Sandbox Code Playgroud)
我已经尝试了很多东西,但它总是导致字符串有\
使用serverName.Replace("\\", @"\");不起作用,它留下它作为\
servername.Replace("\\", "\"");"在字符串中 添加一个仍然不正确的字符串.
请协助.