简体   繁体   English

ZipPackage类vs Zipfile类

[英]ZipPackage Class vs Zipfile class

I feel confused with these two classes, both of them seem used to create or extract zip files? 我对这两个类感到困惑,它们似乎都用于创建或提取zip文件? 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. ZipPackage Class - 实现抽象包基类的派生子类 - ZipPackage类使用ZIP存档作为容器存储。 This class cannot be inherited. 这个类不能被继承。

Zipfile Class - Provides static methods for creating, extracting, and opening zip archives. Zipfile Class - 提供用于创建,提取和打开zip存档的静态方法。

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.packaging.zippackage.aspx

http://msdn.microsoft.com/en-us/library/system.io.compression.zipfile.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. ZipPackage Class用于处理包,它使用zip格式进行存储,但zip中包含特殊的元文件。 A package is a zip, but all zip files aren't packages. 包是zip,但所有zip文件都不是包。 You can only open a package using the Package class, not any zip file. 您只能使用Package类打开包,而不能使用任何zip文件打开包。

when you want just only the zip file I would prefer using zipFile class until I want my zip to be a package. 当你只想要zip文件时,我更喜欢使用zipFile类,直到我希望我的zip成为一个包。

If you only want to zip your file and extract it use zipClass instead 如果您只想压缩文件并将其解压缩,请使用zipClass

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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