gpt4 book ai didi

c# - .NET 中包关系的目的是什么?

转载 作者:太空狗 更新时间:2023-10-29 21:59:31 26 4
gpt4 key购买 nike

.NET 中的包关系 (ZipPackage) 到底是什么?我知道什么是包,但我无法理解关系的目的。您能否举例说明我何时想使用它们以及它们有什么好处?

最佳答案

来自 MSDN (包类):

Package is an abstract class that can be used to organize objects into a single entity of a defined physical format for portability and efficient access.

和:

A PackageRelationship ("relationship") defines an association between a source Package or PackagePart and a target object. A PackageRelationship can be one of two types, each of which can be one of two forms:

* A package-level relationship (created by the Package.CreateRelationship method) relates a Package to either:
o A target part in the package.
o A target resource outside the package.
* A part-level relationship (created by the PackagePart.CreateRelationship method) relates a source PackagePart to either:
o Another target part in the package.
o A target resource outside the package.

所以,当创建一个Package时,如果你想表明一个对象与包的另一部分之间存在关系,你应该使用一个PackageRelationship来表明它是一种什么样的关系。

ZipPackage 也可用于处理 Open Office XML 文件 - 在此用例中,有时指示对象之间的关系很有用。参见 here .

关于c# - .NET 中包关系的目的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4422445/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com