PackagePart Constructor (Package, Uri, String)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the PackagePart class with a specified parent Package, part URI, and MIME content type.

Namespace:   System.IO.Packaging
Assembly:  WindowsBase (in WindowsBase.dll)

protected PackagePart(
	Package package,
	Uri partUri,
	string contentType
)

Parameters

package
Type: System.IO.Packaging.Package

The parent Package of the part.

partUri
Type: System.Uri

The URI of the part, relative to the parent Package root.

contentType
Type: System.String

The MIME content type of the part data stream.

Exception Condition
ArgumentNullException

package or partUri is null.

ArgumentException

partUri is not a valid PackagePart URI.

partUri must be valid PackagePart URI formed in accordance with the RFC 3986 Uniform Resource Identifier (URI) Generic Syntax specification and the Open Packaging Conventions specification.

By default, the CompressionOption property of the part is initialized to NotCompressed.

contentType must be a MIME type formed in accordance with the RFC 2616 Hypertext Transfer Protocol - HTTP, Section 3.7. The following table shows an example of the content MIME types used in XML Paper Specification (XPS) documents.

Description

Content Type

Font

application/vnd.ms-opentype

ICC profile

application/vnd.ms-color.iccprofile

JPEG image

image/jpeg

Obfuscated font

application/vnd.ms-package.obfuscated-opentype

PNG image

image/png

PrintTicket

application/vnd.ms-printing.printticket+xml

TIFF image

image/tiff

Windows Media Photo image

image/vnd.ms-photo

.NET Framework
Available since 3.0
Return to top
Show: