Tag Archives: paths

List characters that are invalid in file and path names in C#

This example uses the following code to display characters that are invalid in file and path names. private void Form1_Load(object sender, EventArgs e) { string txt = “”; foreach (char ch in Path.GetInvalidFileNameChars()) { if (Char.IsWhiteSpace(ch) || Char.IsControl(ch)) txt += … Continue reading

Posted in files, strings | Tagged , , , , , , , , , , , | Leave a comment

Combine and resolve relative paths in C#

Often it’s useful for a C# program to combine relative paths. For example, when you build a program in Visual Studio, the executable program runs in the bin\Debug subdirectory below the source code directory. If you want to manipulate a … Continue reading

Posted in files, system | Tagged , , , , , , , , , , , | 4 Comments