title: FileStream to save file then immediately unlock in .NET?
body: <p>I have this code that saves a pdf file.</p>
  
  <pre><code>FileStream fs = new FileStream(SaveLocation, FileMode.Create);
  fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
  fs.Flush();
  fs.Close();
  </code></pre>
  
  <p>It works fine. However sometimes it does not release the lock right away and that causes file locking exceptions with functions run after this one run. </p>
  
  <p>Is there a ideal way to release the file lock <strong>right after</strong> the <strong>fs.Close()</strong></p>