語言

PackUriHelper.GetPartUri(Uri) 方法

定義

回傳指定包 URI 內的 PackagePart URI。

public:
 static Uri ^ GetPartUri(Uri ^ packUri);
public static Uri? GetPartUri(Uri packUri);
public static Uri GetPartUri(Uri packUri);
static member GetPartUri : Uri -> Uri
Public Shared Function GetPartUri (packUri As Uri) As Uri

參數

packUri
Uri

用來退還 PackagePart URI的PACK RID。

傳回

Uri

在給定 中 的 URI PackagePart 或如果packUri指向一個封包而非 null。packUriPackagePart

例外狀況

如果 是 packUrinull。

若 不是 packUri 絕對 Uri。

-或-

packUri 沒有「pack://」方案。

-或-

從 packUri 中提取的 partUri 不符合有效的 partUri 語法。

備註

回傳 PackagePart 的 URI 相對於套件根節點,且為絕對路徑,始終以「/」開頭,並符合 開放封裝慣例規範中定義的語法。

下表展示了 的 GetPartUri範例情況。

packUri 歸還的部分 URI
pack://http:,,www.proseware.com,mypackage.xyz/a/mydoc.xaml /a/mydoc.xaml
pack://http:,,www.proseware.com,packages.aspx%3fmypackage/a/bar.xaml /a/bar.xaml
pack://http:,,www.proseware.com,mypackage.pkg null
pack://ftp:,,,ftp.proseware.com,packages,mypackage1.abc/a/picture.jpg /a/picture.jpg
pack://file:,,,d:,packages,mypackage2.pkg/a/bar.xaml /a/bar.xaml

適用於

另請參閱