I’m converting from VB to C#, and in C# I seem not to be able to simply write a path string to the application settings..
D:\Something becomes D:\\Something
I tried also @"D:\Something", but that also doesn’t work.
So what is the correct way? Say I want to have two settings; path and filename. How shall I format them, for the purpose of Path.Combine to make this a valid file-path/name for a database, or in other words, to have single backslashes?
Your code is working correctly – when you read a string with doubled slashes back, they becomes single slashes again. This is called escaping. It is designed to let you enter special characters as sequences starting in
\. Single slash becomes special in this scheme, so you need to escape it with a slash as well.