I need a robust and simple way to remove illegal path and file characters from a simple string. I\'ve used the below code but it doesn\'t seem to do anything, what am I miss
Throw an exception.
if ( fileName.IndexOfAny(Path.GetInvalidFileNameChars()) > -1 ) { throw new ArgumentException(); }