Replace method c# not working as expected
asp.net-mvc-4, c#
Solution
It is working. `\\` is not escaped whilst inspecting during debugging. Try printing the value to a console window or the webpage.
Edit* You appear to be confused.
Your path doesn't actually contain any double slashes `\\`, it just looks that way because the single slashes are escaped when viewing the string during debugging. Consider reading up on Escape sequences.
If you want to escape single slashes then don't use a verbatim string literal in your replace e.g. `string.Replace("\\", "-")` which would replace all single slashes in the path with a hyphen `-` though I'm not sure why you would want to do this? Note that this will still show the path as having `\\` slashes in it whilst inspecting during debugging. Printing to a console window would read:
`C:-dev-vsprojects-VerificaionDeFirmas-VerificaionDeFirmas-verificaciondefirmas.txt`
Problem
Im trying to replace double backslash for simple one but it does not work. Here an image: I still wondering why. I saw post like this and it worked for them. Suggestions? Update Sorry i made a mistake, its a single backslashes just i spelled wrong the code to replace is ``` string clear_patch = path.Replace(@"\\","\"); ```