title: How to use the .NET ZipArchive and ZipArchiveEntry classes to extract a file with a PASSWORD
body: <p>I am extracting the contents of a zip file with the following code:</p>
  
  <pre><code>using(ZipArchive zipArchive = new ZipArchive(memoryStream))
  {
      foreach (ZipArchiveEntry entry in zipArchive.Entries)
      {
          entry.ExtractToFile("extract.txt");
      }
  }
  </code></pre>
  
  <p>This works perfectly for those zip files which are not password protected, however, I need it to also work for those passwords which are password protected.  </p>
  
  <p>I have seen other samples which can achieve what I want using other classes or other code but I find this way to be very clean and I hope that there is a property where I can set the password (it shouldn't need to be any more difficult than that).</p>
  
  <p>Thanks in advance.</p>