共用方式為


ResourceMap 類別

定義

相關資源的集合,通常是針對特定應用程式套件,或特定套件的資源檔。

public ref class ResourceMap sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.ApplicationModel.Resources.MrtContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ResourceMap final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.ApplicationModel.Resources.MrtContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ResourceMap
Public NotInheritable Class ResourceMap
繼承
Object Platform::Object IInspectable ResourceMap
屬性

備註

資源識別碼語法

此類別的許多方法都會使用資源識別碼作為參數。 資源識別碼會被視為統一資源識別項 (URI) 片段,受限於統一資源識別項 (URI) 語意。 例如,GetValue (「Caption%20」) 會被視為 GetValue (「Caption 」) 。

勿在資源識別碼中使用「?」或「#」,因為它們會終止資源路徑評估。 例如,「MyResource?3」會被視為「MyResource」。

屬性

ResourceCount

取得 ResourceMap中的資源數目。

方法

GetSubtree(String)

會傳回 ResourceMap ,代表另一個 ResourceMap 的一部分,通常用來存取應用程式套件內的特定資源檔。

這個方法會尋找子樹、上階、同層級和同層級對應至此資源對應,以及最上層地圖。 它會傳回指定資源對應識別碼所代表的資源對應,相對於此資源對應。 這個方法通常用來對特定資源子集進行更簡單的參考,例如單一資源檔或檔案目錄。

GetValue(String)

針對預設內容中的資源識別碼所指定的資源,傳回最適合的候選項目。

GetValue(String, ResourceContext)

針對提供之內容的資源識別碼所指定的資源,傳回最適合的候選項目。

GetValueByIndex(UInt32)

傳回預設內容中指定索引處的資源。

GetValueByIndex(UInt32, ResourceContext)

傳回指定內容中位於指定索引處的資源。

TryGetValue(String)

嘗試尋找預設內容中資源識別碼所指定之資源最適當的候選項目。

TryGetValue(String, ResourceContext)

嘗試尋找由所提供內容之資源識別碼所指定之資源最適當的候選項目。

適用於