C# Directory EnumerateFiles:掩码“*.*”和“*”之间的区别?

C# Directory EnumerateFiles: the difference between masks "*.*" and "*"?

我正在使用函数 Directory.EnumerateFiles 枚举目录中的所有文件。

我使用搜索模式 "*" 但在许多示例中,我看到了模式 "*.*"

我的问题:掩码 "*.*""*" 有什么区别?

“*”表示任意文件,“*.*”表示:第一个*为任意文件名,第二个*为该文件名的任意扩展名。

它们应该是相同的,至少在 .Net Framework 中是这样。

参考来源Directory.EnumerateFiles, it uses FindFirstFile WinAPI function underneath (from this部分参考来源)。

FindFirstFile 将没有扩展名的文件包含到 *.* 搜索模式中(在这个问题 Bug in Windows's FindFirstFile() function? 中更详细)。所以与 * 掩码的方式相同 - 所有具有任何扩展名的文件,即使扩展名是空的。