title: How to implement an async File.Delete/Create/Move?
body: <p>Since I have to do a lot of file I/O operations in my application,
  I decided to implement them asynchronously.
  Looking into the MSDN, there are no asynchronous counterparts for File.Create, File.Delete and File.Move. As I learned, the reason is the nonexistence of an asynchronous Win32 implementation for file delete, create or move, So I ended up with the following solution:</p>
  
  <pre><code>public static Task DeleteAsync(string path)
  {
       Guard.FileExists(path);
  
       return Task.Run(() =&gt; File.Delete(path));
  }
  
  public static Task&lt;FileStream&gt; CreateAsync(string path)
  {
       Guard.IsNotNullOrWhitespace(path);
  
       return Task.Run(() =&gt; File.Create(path));
  }
  
  public static Task MoveAsync(string sourceFileName, string destFileName)
  {
       Guard.FileExists(sourceFileName);
       Guard.IsNotNullOrWhitespace(destFileName);
  
       return Task.Run(() =&gt; { File.Move(sourceFileName, destFileName); });
  }
  </code></pre>
  
  <p>Considering the paradigma <a href="http://blog.stephencleary.com/2013/11/taskrun-etiquette-examples-dont-use.html" rel="noreferrer">"Don’t use Task.Run in Libraries"</a> , I am wondering if there is a better implementation or should I fallback to synchronous code?</p>
  
  <p>Many thanks in advance!</p>
  
  <p>Edits:</p>
  
  <hr>
  
  <ul>
  <li>Improved the code based on Peter Duniho recommendation </li>
  <li>Added the link to the original blog post provided by Sriram Sakthivel</li>
  </ul>