I’m using Path.Combine like so:
Path.Combine("test1/test2", "test3\\test4");
The output I get is:
test1/test2\test3\test4
Notice how the forward slash doesn’t get converted to a backslash. I know I can do string.Replace to change it, but is there a better way of doing this?
Because your “test1/test2” is already a string literal, Path.Combine will not change the ‘/’ for you to a ‘\’.
Path.Combine will only concat the 2 string literals with the appropriate path delimiter used by the OS, in this case Windows, which is ‘\’, from there your output
Your best bet would be the string.Replace.