How do I get .NET's Path.Combine to convert forward slashes to backslashes?

前端 未结 8 2179
[愿得一人]
[愿得一人] 2021-02-03 16:39

I\'m using Path.Combine like so:

Path.Combine(\"test1/test2\", \"test3\\\\test4\");

The output I get is:

test1/test2\\test3\\te         


        
8条回答
  •  星月不相逢
    2021-02-03 17:29

    No, the seperator character is defined as a Read Only.

    http://msdn.microsoft.com/en-us/library/system.io.path.pathseparator.aspx

    You should use a Replace as it's a trivial change.

提交回复
热议问题