LINQ to Files/Directory

Wil*_*lem 0 c# linq directory file

如何使用LINQ在特定目录中查找特定文件,如果存在则返回true?

And*_*ber 11

为什么要使用LINQ呢?这可以满足您的需求:

string filePath = Path.Combine(directory, fileName);
return File.Exists(filePath);
Run Code Online (Sandbox Code Playgroud)