区分大小写 Directory.Exists / File.Exists

2024-04-21

有没有办法区分大小写Directory.Exists / File.Existssince

Directory.Exists(folderPath)

and

Directory.Exists(folderPath.ToLower())

都返回true?

大多数时候这并不重要,但我使用的是一个宏,如果路径与大小写不100%匹配,它似乎不起作用。


由于 Directory.Exists 使用查找第一个文件 http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418%28v=vs.85%29.aspx这不区分大小写,不。但是你可以PInvoke FindFirstFileEx http://www.pinvoke.net/default.aspx/kernel32/findfirstfileex.html将additionalFlags参数设置为FIND_FIRST_EX_CASE_SENSITIVE http://msdn.microsoft.com/en-au/library/windows/desktop/aa364419%28v=vs.85%29.aspx

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

区分大小写 Directory.Exists / File.Exists 的相关文章

随机推荐