SiteMapNode.GetExplicitResourceString(String, String, Boolean) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ローカライズする SiteMapNode 属性、リソースが見つからない場合に返す既定の文字列、およびリソースが見つからない場合に例外をスローするかどうかを示すブール値に基づいて、ローカライズされた文字列を取得します。
protected:
System::String ^ GetExplicitResourceString(System::String ^ attributeName, System::String ^ defaultValue, bool throwIfNotFound);
protected string GetExplicitResourceString(string attributeName, string defaultValue, bool throwIfNotFound);
member this.GetExplicitResourceString : string * string * bool -> string
Protected Function GetExplicitResourceString (attributeName As String, defaultValue As String, throwIfNotFound As Boolean) As String
パラメーター
- attributeName
- String
ローカライズする SiteMapNode 属性。
- defaultValue
- String
一致するリソースが見つからない場合に返される既定値。
- throwIfNotFound
- Boolean
true
InvalidOperationExceptionをスローする場合、attributeNameに対して明示的なリソースが定義されている場合、defaultValueはnullされ、ローカライズされた値が見つかりません。それ以外の場合はfalse。
返品
ローカライズされた属性を表す文字列。
例外
attributeName は nullです。
一致するリソース オブジェクトが見つからず、 throwIfNotFound が true。
注釈
GetExplicitResourceString メソッドは、get プロパティ、Title プロパティ、および Description プロパティで定義されているカスタム属性のAttributes アクセサーで呼び出されます。
SiteMapProviderを追跡するSiteMapNode オブジェクトは、ローカライズされた文字列を返すために、EnableLocalization メソッドのtrue プロパティをGetExplicitResourceStringに設定する必要があります。
EnableLocalizationが false に設定されている場合、ローカライズは実行されず、GetExplicitResourceString メソッドは呼び出されません。
Title プロパティ、Description プロパティ、および Attributes プロパティで定義されているカスタム属性は、最初にGetImplicitResourceString メソッドを呼び出します。
nullが返された場合、GetExplicitResourceString メソッドは、明示的なリソース式の既定値に設定defaultValue (定義されている場合) を使用して呼び出され、throwIfNotFoundtrueに設定されます。
Note
XmlSiteMapProvider クラスは、SiteMapNode オブジェクトが属性の暗黙的なリソース式と明示的なリソース式の両方を定義できないという制限を課します。 ただし、カスタム プロバイダーの実装では、両方を許可することを選択できます。
GetExplicitResourceString メソッドは、NameValueCollection オブジェクトが初期化されたリソース キーのSiteMapNode コレクションを使用します。 リソース キーのコレクションが指定されていない場合、 GetExplicitResourceString は nullを返します。