.NET Framework Class Library
PackagePart Class

Provides a base class for parts stored in a Package. This class is abstract.

Namespace:   System.IO.Packaging
Assembly:  WindowsBase (in WindowsBase.dll)
Syntax
Public MustInherit Class PackagePart
public abstract class PackagePart
public ref class PackagePart abstract
[<[%$TOPIC/ms571912_en-us_VS_110_3_0_3_0_0%]>]
type PackagePart =  class end

The PackagePart type exposes the following members.

Constructors
  NameDescription
Protected method PackagePart(Package, Uri)Initializes a new instance of the PackagePart class with a specified parent Package and part URI.
Protected method PackagePart(Package, Uri, String)Initializes a new instance of the PackagePart class with a specified parent Package, part URI, and MIME content type.
Protected method PackagePart(Package, Uri, String, CompressionOption)Initializes a new instance of the PackagePart class with a specified parent Package, part URI, MIME content type, and CompressionOption.
Top
Properties
  NameDescription
Public property CompressionOptionGets the compression option of the part content stream.
Public property ContentTypeGets the MIME type of the content stream.
Public property PackageGets the parent Package of the part.
Public property UriGets the URI of the part.
Top
Methods
  NameDescription
Public method CreateRelationship(Uri, TargetMode, String)Creates a part-level relationship between this PackagePart to a specified target PackagePart or external resource.
Public method CreateRelationship(Uri, TargetMode, String, String)Creates a part-level relationship between this PackagePart to a specified target PackagePart or external resource.
Public method DeleteRelationshipDeletes a specified part-level PackageRelationship.
Public method Equals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Protected method GetContentTypeCoreWhen overridden in a derived class, returns the MIME type of the part content.
Public method GetHashCodeServes as the default hash function. (Inherited from Object.)
Public method GetRelationshipReturns the relationship that has a specified Id.
Public method GetRelationshipsReturns a collection of all the relationships that are owned by this part.
Public method GetRelationshipsByTypeReturns a collection of the relationships that match a specified RelationshipType.
Public method GetStreamReturns the part content data stream.
Public method GetStream(FileMode)Returns the content stream opened in a specified I/O FileMode.
Public method GetStream(FileMode, FileAccess)Returns the part content stream opened with a specified FileMode and FileAccess.
Protected method GetStreamCoreWhen overridden in a derived class, returns the part content stream opened with a specified FileMode and FileAccess.
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public method RelationshipExistsReturns a value that indicates whether this part owns a relationship with a specified Id.
Public method ToStringReturns a string that represents the current object. (Inherited from Object.)
Top
Remarks

A PackagePart consists of three basic elements:

Access

Description

Uri

The URI of the part.

ContentType

The MIME type of the content stream.

GetStream

The content data stream of the part.

Version Information

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.