Question

I have a path string like c:\user\test\test.jpg, how can I make it c:\\user\\test\\test.jpg?

Was it helpful?

Solution

string s = s.Replace(@"\", @"\\");

OTHER TIPS

Try this:

string path = @"c:\user\test\test.jpg";

you would only require escaping if you are using string literal in the code. why would you require automatic escaping anyways. you can use @ before the literal that requires no escaping.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top