简体   繁体   中英

ZipPackage Class vs Zipfile class

I feel confused with these two classes, both of them seem used to create or extract zip files? Can anyone explain the difference?

ZipPackage Class - Implements a derived subclass of the abstract Package base class—the ZipPackage class uses a ZIP archive as the container store. This class cannot be inherited.

Zipfile Class - Provides static methods for creating, extracting, and opening zip archives.

refer these links to get exact differences http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx

http://msdn.microsoft.com/en-us/library/system.io.compression.zipfile.aspx

ZipPackage Class is used to handle packages, which uses the zip format for storage, but has special meta files included in the zip. A package is a zip, but all zip files aren't packages. You can only open a package using the Package class, not any zip file.

when you want just only the zip file I would prefer using zipFile class until I want my zip to be a package.

If you only want to zip your file and extract it use zipClass instead

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM