simple right parenthesy placement mishap in the if statement, but awesome thanks!
So "C::::::::" is a valid filename?
Andrew: no, this is just a rough basic check for characters.. There are lots of other reasons accessing a file with proposedFilename may fail: file (doesn't) exist, read-only, path too long, directory doesn't exist, name is a dos device files (like 'nul' or 'prn') etc.
It depends on what you want to achive. I came here from a google query and I want to check only for valid file names (not a full path) and I'm pretty sure you can't have a file called "c:\a.txt" inside a folder ;)
Yes, for checking only name of the file Path.GetInvalidFileNameChars() acceptable, but Naming Conventions (msdn.microsoft.com/en-us/library/…) have a lot of interesting rules.