Xceed .NET Libraries Documentation
GetZipContents method

Welcome to Xceed .NET, .NET Standard and Xamarin Libraries! > Basic Concepts > The Quick classes > Quick classes versus FileSystem > GetZipContents method

Xceed Zip for .NET gives you the possibility to list the contents of zip files. For more information, you can refer to the Listing the contents of a zip file topics for both QuickZip and the FileSystem object model.

QuickZip Example

The following example demonstrates how to list the contents of a zip file using the static GetZipContents method of the QuickZip class.

VB.NET Copy Code

Imports Xceed.Zip

Dim items As QuickZipItem()
Dim item As QuickZipItem

items = QuickZip.GetZipContents( "c:\test.zip", "*" )

For Each item In items
  Console.WriteLine( item.Name )
Next

C# Copy Code
using Xceed.Zip;
 
QuickZipItem[] items = QuickZip.GetZipContents( @"c:\test.zip", "*" );
   
foreach( QuickZipItem item in items)
{
  Console.WriteLine( item.Name );
}

FileSystem Example

The following example demonstrates how to list the contents of a zip file using the FileSystem object model.

VB.NET Copy Code

Imports Xceed.Zip
Imports Xceed.FileSystem

Dim zip As New ZipArchive( New DiskFile( "c:\test.zip" ) )
Dim f As AbstractFile

For Each f In zip.GetFiles( True )  
  ListBox1.Items.Add( f.FullName )
Next

C# Copy Code

using Xceed.Zip;
using Xceed.FileSystem;


ZipArchive zip = new ZipArchive( new DiskFile( @"c:\test.zip" ) );

foreach( AbstractFile f in zip.GetFiles( true ) )
{
  Console.WriteLine( f.FullName );
}

For more information, you can refer to the "Listing the contents of a zip file" topics for both QuickZip and the FileSystem object model.