Generally most of the codes of the following methods to create a path to use:

string path = somePath + "\" + filename;

But if the program is run under Mono on Linux problem on the Linux route because this time there are as follows:




It is therefore recommended for paths in your program, Path.Combine method in the System.IO namespace to use.Because this method of preparation of the final values ​​Path.VolumeSeparatorChar Path.DirectorySeperatorChar and uses. The values ​​in Windows (\) and Linux (/) varies automatically at runtime by the framework will be used by management.
The other advantage of using Path.Combine, the input is valid, this means that if the unauthorized use of characters, an exception will be issued.
Just add another one might not be bad and it is Environment.NewLine philosophy. The usual practice is that a new row with \n at the end of a string, but this is not always true and in different platforms. Windows Environment.NewLine equal \r \n and Unix-based systems in equal \n will be. Therefore it is better instead of the \n use of Environment.NewLine for the construction of new lines.