Closes the read and write streams associated
to the ZipFile, if necessary.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public void Dispose()
Public Sub Dispose
public: virtual void Dispose() sealed
Remarks
The Dispose() method is generally employed implicitly, via a using(..) {..}
statement. (Using...End Using in VB) If you do not employ a using
statement, insure that your application calls Dispose() explicitly. For
example, in a Powershell application, or an application that uses the COM
interop interface, you must call Dispose() explicitly.
Examples
This example extracts an entry selected by name, from the Zip file to the
Console.
CopyC#
using (ZipFile zip = ZipFile.Read(zipfile)) { foreach (ZipEntry e in zip) { if (WantThisEntry(e.FileName)) zip.Extract(e.FileName, Console.OpenStandardOutput()); } } // Dispose() is called implicitly here.
CopyVB.NET
Using zip As ZipFile = ZipFile.Read(zipfile) Dim e As ZipEntry For Each e In zip If WantThisEntry(e.FileName) Then zip.Extract(e.FileName, Console.OpenStandardOutput()) End If Next End Using ' Dispose is implicity called here