SiteMapNode.GetExplicitResourceString(String, String, Boolean) Methode
Definition
Ruft eine lokalisierte Zeichenfolge auf der Grundlage eines zu lokalisierenden SiteMapNode-Attributs, eine zurückzugebende Standardzeichenfolge (wenn keine Ressource gefunden wird) und einen booleschen Wert ab, der angibt, ob eine Ausnahme ausgelöst werden soll, wenn keine Ressource gefunden wird.Retrieves a localized string based on a SiteMapNode attribute to localize, a default string to return if no resource is found, and a Boolean value indicating whether to throw an exception if no resource is found.
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
Parameter
- attributeName
- String
Das zu lokalisierende SiteMapNode-Attribut.The SiteMapNode attribute to localize.
- defaultValue
- String
Der Standardwert, der zurückgegeben werden soll, wenn keine übereinstimmende Ressource gefunden wird.The default value to return if a matching resource is not found.
- throwIfNotFound
- Boolean
true
, um eine InvalidOperationException auszulösen, wenn eine explizite Ressource für attributeName
definiert ist, defaultValue
null
ist und kein lokalisierter Wert gefunden wird, andernfalls false
.true
to throw an InvalidOperationException, if an explicit resource is defined for attributeName
, defaultValue
is null
, and a localized value is not found; otherwise, false
.
Gibt zurück
Eine Zeichenfolge, die das lokalisierte Attribut darstellt.A string representing the localized attribute.
Ausnahmen
attributeName
ist null
.attributeName
is null
.
Es wurde kein übereinstimmendes Ressourcenobjekt gefunden, und throwIfNotFound
ist true
.A matching resource object was not found and throwIfNotFound
is true
.
Hinweise
Die GetExplicitResourceString -Methode wird im get
-Accessor der Title -Eigenschaft, der Description -Eigenschaft und allen benutzerdefinierten Attributen aufgerufen, die in der-Eigenschaft definiert sind Attributes .The GetExplicitResourceString method is invoked in the get
accessor of the Title property, the Description property, and any custom attributes that are defined in the Attributes property. Das SiteMapProvider Objekt, durch das der nach SiteMapNode verfolgt wird, muss die- EnableLocalization Eigenschaft auf festlegen, true
damit die- GetExplicitResourceString Methode eine lokalisierte Zeichenfolge zurückgibt.The SiteMapProvider object by which the SiteMapNode is tracked must have its EnableLocalization property set to true
for the GetExplicitResourceString method to return a localized string. Wenn EnableLocalization auf festgelegt ist false
, wird die Lokalisierung nicht durchgeführt, und die- GetExplicitResourceString Methode wird nie aufgerufen.If the EnableLocalization is set to false
, localization is not performed and the GetExplicitResourceString method is never called.
Die Title -Eigenschaft, die Description -Eigenschaft und alle benutzerdefinierten Attribute, die in der-Eigenschaft definiert sind, Attributes rufen zunächst die- GetImplicitResourceString Methode auf.The Title property, the Description property, and any custom attributes that are defined in the Attributes property first invoke the GetImplicitResourceString method. Wenn zurückgegeben wird null
, GetExplicitResourceString wird die-Methode aufgerufen, wobei defaultValue
auf den Wert des Standardwerts aus dem expliziten Ressourcen Ausdruck festgelegt wird (sofern definiert) und throwIfNotFound
auf festgelegt ist true
.If it returns null
, the GetExplicitResourceString method is invoked with defaultValue
set to the value of the default value from the explicit resource expression (assuming one was defined) and throwIfNotFound
set to true
.
Hinweis
Die- XmlSiteMapProvider Klasse erzwingt die Einschränkung, dass das- SiteMapNode Objekt nicht sowohl implizite Ressourcen Ausdrücke als auch explizite Ressourcen Ausdrücke für Attribute definieren kann.The XmlSiteMapProvider class imposes the restriction that the SiteMapNode object cannot define both implicit resource expressions and explicit resource expressions for attributes. Eine benutzerdefinierte Anbieter Implementierung kann jedoch beide Optionen zulassen.However, a custom provider implementation can choose to allow both.
Die- GetExplicitResourceString Methode verwendet die Auflistung NameValueCollection von Ressourcen Schlüsseln, SiteMapNode mit denen das Objekt initialisiert wurde.The GetExplicitResourceString method uses the NameValueCollection collection of resource keys that the SiteMapNode object was initialized with. Wenn keine Auflistung von Ressourcen Schlüsseln angegeben wurde, wird GetExplicitResourceString zurückgegeben null
.If a collection of resource keys was not specified, the GetExplicitResourceString returns null
.