PackagePart.GetRelationshipsByType(String) 方法

定义

返回与指定 RelationshipType 相匹配的关系的集合。Returns a collection of the relationships that match a specified RelationshipType.

public:
 System::IO::Packaging::PackageRelationshipCollection ^ GetRelationshipsByType(System::String ^ relationshipType);
public System.IO.Packaging.PackageRelationshipCollection GetRelationshipsByType (string relationshipType);
member this.GetRelationshipsByType : string -> System.IO.Packaging.PackageRelationshipCollection
Public Function GetRelationshipsByType (relationshipType As String) As PackageRelationshipCollection

参数

relationshipType
String

要在集合中查找并返回的关系的 RelationshipTypeThe RelationshipType of the relationships to locate and return in the collection.

返回

PackageRelationshipCollection

与指定 relationshipType 相匹配的关系的集合。A collection of the relationships that match the specified relationshipType.

例外

relationshipTypenullrelationshipType is null.

relationshipType 是一个空字符串。relationshipType is an empty string.

已删除此部分。The part has been deleted.

- 或 --or- Package 没有打开(调用了 Dispose(Boolean)Close())。The Package is not open (Dispose(Boolean) or Close() has been called).

包是只写的(无法读取关系信息)。The package is write-only (relationship information cannot be read).

注解

返回的集合始终为 null ; 但是,如果没有与为部件定义的指定匹配的关系,则集合可能包含零个元素 relationshipTypeThe returned collection is never null; however, the collection might contain zero elements if no relationships match the specified relationshipType that is defined for the part.

字符串中的所有前导空格或尾随空格 relationshipType 都将自动裁剪。Any leading or trailing spaces in the relationshipType string are automatically trimmed.

适用于