How to detect filename is invalid.

  • Thread starter Thread starter XingZheng
  • Start date Start date
X

XingZheng

Hi

Could you tell me how to get InvalidFilenameCharacter in C# like
Path.InvalidPathChars.



Thanks.
 
XingZheng said:
Hi

Could you tell me how to get InvalidFilenameCharacter in C# like
Path.InvalidPathChars.

You might do better to simply try to create the file, then catch any
exceptions which may be raised. That will cover problems with invalid file
name characters or anything else.
 
Poolbeer (MCP) said:
You could use Regular Expressions to look for invalid characters.

That will fail as soon as the definition of "invalid" changes.
 
Back
Top