| c# Programming Glossary: path.getinvalidpathcharsHow to remove illegal characters from path and filenames? http://stackoverflow.com/questions/146134/how-to-remove-illegal-characters-from-path-and-filenames  Path.GetInvalidFileNameChars  illegal illegal.Trim Path.GetInvalidPathChars  Console.WriteLine illegal Console.ReadLine    c# string path.. invalid new string Path.GetInvalidFileNameChars new string Path.GetInvalidPathChars foreach char c in invalid illegal illegal.Replace c.ToString.. new string Path.GetInvalidFileNameChars new string Path.GetInvalidPathChars Regex r new Regex string.Format 0 Regex.Escape regexSearch illegal.. 
 C# Sanitize File Name http://stackoverflow.com/questions/309485/c-sharp-sanitize-file-name  string dir Path.GetDirectoryName path foreach char c in Path.GetInvalidPathChars dir dir.Replace c replaceChar string name Path.GetFileName path.. exceptions. It turned out that ' ' is not in the set of Path.GetInvalidPathChars because it is valid in a path root. I suppose that makes sense.. List char Path.GetInvalidFileNameChars  _BadChars.AddRange Path.GetInvalidPathChars  _BadChars Utility.GetUnique char _BadChars  remove root string.. 
 How check if given string is legal (allowed) file name under Windows? http://stackoverflow.com/questions/62771/how-check-if-given-string-is-legal-allowed-file-name-under-windows  question  You can get a list of invalid characters from Path.GetInvalidPathChars http msdn.microsoft.com en us library system.io.path.getinvalidpathchars.aspx.. 
 |