标签云

微信群

扫码加入我们

WeChat QR Code


simple right parenthesy placement mishap in the if statement, but awesome thanks!

2018年09月26日59分44秒

So "C::::::::" is a valid filename?

2018年09月25日59分44秒

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.

2018年09月26日59分44秒

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 ;)

2018年09月25日59分44秒

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.

2018年09月25日59分44秒