I am trying to verify that there is a file with a certain filename in a zip file. Is there a better way to do it than the following?
using (ZipArchive archive = ZipFile.OpenRead(zipFilePath))
{
if (!archive.Entries.Any(e => e.Name.Equals(FileNameToCheckFor)))
{
// Throw an exception
}
foreach (ZipArchiveEntry file in archive.Entries)
{
// Do some processing. This is unrelated.
}
}
varinstead of the type name in theusingfor example:using (var archive = ...)