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
返回
一个表示本地化属性的字符串。
例外
attributeName 是 null。
找不到匹配的资源对象,并且 throwIfNotFound 是 true。
注解
该方法GetExplicitResourceString在get属性、Description属性和属性中定义的任何自定义属性的访问器Title中Attributes调用。
SiteMapProvider所跟踪的对象SiteMapNode必须将其EnableLocalization属性设置为true该方法GetExplicitResourceString以返回本地化字符串。 如果设置为 EnableLocalizationfalse,则不会执行本地化,GetExplicitResourceString并且永远不会调用该方法。
属性 Title 、 Description 属性和属性中 Attributes 定义的任何自定义属性首先调用该方法 GetImplicitResourceString 。 如果返回
注释
该 XmlSiteMapProvider 类施加了 SiteMapNode 该对象不能为属性定义隐式资源表达式和显式资源表达式的限制。 但是,自定义提供程序实现可以选择允许这两者。
该方法 GetExplicitResourceString 使用 NameValueCollection 对象初始化的资源键 SiteMapNode 的集合。 如果未指定资源键的集合,则 GetExplicitResourceString 返回 null。