How can I get the path from Path.GetTempPath()
in a format like this:
C:\\Users\\m3\\AppData\\Local\\Temp\\
Not like this:
C:\Users\m3\AppData\Local\Temp\
I mean I want it with \
scape characters. Is there an automatic way? Or do I have to add \
characters myself?
I need to write the path to a file and the \
characters have to be \\
.
A simple way to double the separator char in a path is the following
var psep = Path.DirectorySeparatorChar;
var p = Path.GetTempPath().Replace($"{psep}", $"{psep}{psep}");
Console.WriteLine(p);