Reputation: 2610
I feel confused with these two classes, both of them seem used to create or extract zip files? Can anyone explain the difference?
Upvotes: 7
Views: 4085
Reputation: 4254
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
Upvotes: 4