There is no built-in library.
There are open-source options.
DotNetZip is one. Simple, easy to use. It has good features: AES Encryption, regular encryption, streams, ZIP64, file comments, Unicode, progress events, more. And it's free and open source.
Here's some sample code.
// extract all Photoshop files larger than 100mb
using (ZipFile zip1 = ZipFile.Read(ZipFileName))
{
var LargePhotoShopFiles = zip1.SelectEntries("name = *.psd and size > 100mb");
foreach (ZipEntry e in LargePhotoShopFiles)
{
if (e.UsesEncryption)
e.ExtractWithPassword("unpackDirectory", "VerySecret!");
else
e.Extract("unpackDirectory");
}
}
I believe that the classes in the System.IO.Compression namespace are fine for compressing/decompressing a single stream of data, but there's nothing built into the framework to cope with actual zip files.
EDIT: As noted in Ants' answer, there's System.IO.Packaging.ZipPackage but it certainly looks like that's really designed for use in WPF, and wouldn't be terribly convenient to use for general zip file handling. Worth looking into though. I wasn't aware of it before though... definitely worth investigating.
There is no built-in library. There are open-source options.
DotNetZip is one. Simple, easy to use. It has good features: AES Encryption, regular encryption, streams, ZIP64, file comments, Unicode, progress events, more. And it's free and open source.
Here's some sample code.
EDIT: See note in comments - SharpZipLib is now unmaintained, and you probably want to avoid it.
Open source: #ZipLib
I believe that the classes in the
System.IO.Compression
namespace are fine for compressing/decompressing a single stream of data, but there's nothing built into the framework to cope with actual zip files.EDIT: As noted in Ants' answer, there's System.IO.Packaging.ZipPackage but it certainly looks like that's really designed for use in WPF, and wouldn't be terribly convenient to use for general zip file handling. Worth looking into though. I wasn't aware of it before though... definitely worth investigating.