I am trying to write a function to determine if a file exists. The two methods prove to return inconsistent results (fileExists() seems to provide accurate results, compared
You can create a FileInfo for an non-existing file. But then you can check the FileInfo.Exists property to determine whether the file exists, e.g:
FileInfo fi = new FileInfo(somePath);
bool exists = fi.Exists;
Update: In a short test this also worked for UNC paths, e.g. like this:
FileInfo fi = new FileInfo(@"\\server\share\file.txt");
bool exists = fi.Exists;
Are you sure that the account (under which your application is running) has access to the share. I think that (by default) administrative rights are required to access the share "c$".