title: How do I check whether File.Delete() will succeed without trying it, in C#?
body: <p>In C#, System.IO.File.Delete(filePath) will either delete the specified file, or raise an exception. If the current user doesn't have permission to delete the file, it'll raise an UnauthorizedAccessException.</p>
  
  <p>Is there some way that I can tell ahead of time whether the delete is likely to throw an UnauthorizedAccessException or not (i.e. query the ACL to see whether the current thread's identity has permission to delete the specified file?)</p>
  
  <p>I'm basically looking to do:</p>
  
  <pre><code>if (FileIsDeletableByCurrentUser(filePath)) {
      /* remove supporting database records, etc. here */
      File.Delete(filePath);
  }
  </code></pre>
  
  <p>but I have no idea how to implement FileIsDeletableByCurrentUser().</p>