I do not know why the File.ExistsAsync method does not exist. It is possible that βanother process can potentially do something with the file between the moment you call the Exists method and perform another operation on the file, for example,β Delete β, and that to exclude the correct function, the application that accesses the existing file.
In any case, you can write your own.
public static async Task<bool> FileExistsAsync(string file) { return await Task.Factory.StartNew(() => File.Exists(file)); }
... which, of course, does not use IO Completion to get asynchronous I / O ...
Update: I think the file is usually a handy wrapper. You can do almost everything File offers using other APIs that offer asynchronous features. In the case of Exists it does not use anything that could use IO I / O ports, it just calls FindFirstFile and checks for an error.
source share