c# - 区分大小写 Directory.Exists/File.Exists

标签 c# file directory case-sensitive file-exists

有没有办法让 Directory.Exists/File.Existssince

区分大小写
Directory.Exists(folderPath)

Directory.Exists(folderPath.ToLower())

都返回 true?

大多数时候这无关紧要,但我使用的宏似乎在路径与大小写不匹配 100% 时不起作用。

最佳答案

由于 Directory.Exists 使用 FindFirstFile不区分大小写,不。但是你可以PInvoke FindFirstFileEx additionalFlags 参数设置为 FIND_FIRST_EX_CASE_SENSITIVE

关于c# - 区分大小写 Directory.Exists/File.Exists,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16183788/

相关文章:

c# - 关于 MVC 中聚合关系对象的一个​​简单问题

file - Laravel 中包含 Route 类的文件在哪里?

c++ - Windows文件夹密码

c++ - CreateDirectory 不创建目录 VS2017 c++

c# - 如果要处理 SqlDataReader,是否需要调用 close()?

c# - 无法识别 Serilog 的 AddSerilog

c# - 将十六进制代码转换为颜色名称

windows - 一个PHP开发者的文件同步程序

javascript - RegExp 仅匹配包含文件名的路径

linux - Unix Shell 在里面创建多个目录和随机文件(空)