In my project I save xml-files to a folder. The variable "header" contains the name of the file.
string header = "anyString";
The line to save the file is:
xmlDoc.Save($@"D:\00_Coding\00_Repos\MarcSchaetz\MarcSchaetz.STCut\Data\{header}.cutml");
That works good and all, except when the header contains a slash (/) like:
string header = "d/d";
Then I get a DirectoryNotFoundException
because Visual Studio couldn't find the path
"D:\00_Coding\00_Repos\MarcSchaetz\MarcSchaetz.STCut\Data\d\d.cutml"
So Visual Studio replaces the slash automatically with a backslash. But why and how can I still save a file with a slash in my variable?