title: How can I use sevenzipsharp to asynchronously unzip a list of archives and dispose of them correctly?
body: <p>How can I use SevenZipSharp to asynchronously unzip a list of archives and dispose of them correctly?</p>
  
  <p>Here is what I'm looking at:</p>
  
  <pre><code>Public Class SevenZipVB
  
  Private Shared extractors As New List(Of SevenZipVB)
  
  Private WithEvents _extractor As SevenZip.SevenZipExtractor
  
  
  ''' &lt;summary&gt;
  ''' Extracts list of archives to their current directory always overwriting
  ''' &lt;/summary&gt;
  ''' &lt;param name="archives"&gt;List of full path names to archives&lt;/param&gt;
  Public Shared Sub BeginExtraction(ByVal archives As List(Of String))
  
      For Each archive In archives
          Dim ext = New SevenZipVB(archive)
          extractors.Add(ext)
      Next
  
      'magically wait for all extraction to finish but allow the calling thread to continue
  
  End Sub
  
  Private Sub New(ByVal archive As String)
      _extractor = New SevenZip.SevenZipExtractor(archive)
      _extractor.BeginExtractArchive(Path.GetDirectoryName(archive))
  End Sub
  
  Private Sub extractfinished() Handles _extractor.ExtractionFinished
      _extractor.Dispose()
  End Sub
  
  End Class
  </code></pre>
  
  <p>I guess I'll have to add some kind of async method but I don't know what it should look like. Any ideas?</p>