EntryFileNames Property

DotNetZip

Ionic Zip Library v1.9.1.6 EntryFileNames Property
ReferenceIonic.ZipZipFileEntryFileNames
The list of filenames for the entries contained within the zip archive.
Declaration Syntax
C# Visual Basic Visual C++
public ICollection<string> EntryFileNames { get; }
Public ReadOnly Property EntryFileNames As ICollection(Of String)
	Get
public:
property ICollection<String^>^ EntryFileNames {
	ICollection<String^>^ get ();
}
Return Value
The list of strings for the filenames contained within the Zip archive.
Remarks
According to the ZIP specification, the names of the entries use forward slashes in pathnames. If you are scanning through the list, you may have to swap forward slashes for backslashes.
Examples
This example shows one way to test if a filename is already contained within a zip archive.
CopyC#
String zipFileToRead= "PackedDocuments.zip";
string candidate = "DatedMaterial.xps";
using (ZipFile zip = new ZipFile(zipFileToRead))
{
  if (zip.EntryFilenames.Contains(candidate))
    Console.WriteLine("The file '{0}' exists in the zip archive '{1}'",
                      candidate,
                      zipFileName);
  else
    Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'",
                      candidate,
                      zipFileName);
  Console.WriteLine();
}
CopyVB.NET
Dim zipFileToRead As String = "PackedDocuments.zip"
Dim candidate As String = "DatedMaterial.xps"
Using zip As ZipFile.Read(ZipFileToRead)
    If zip.EntryFilenames.Contains(candidate) Then
        Console.WriteLine("The file '{0}' exists in the zip archive '{1}'", _
                    candidate, _
                    zipFileName)
    Else
      Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'", _
                    candidate, _
                    zipFileName)
    End If
    Console.WriteLine
End Using

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)