HttpContext.GetLocalResourceObject 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取页面级资源。
重载
| 名称 | 说明 |
|---|---|
| GetLocalResourceObject(String, String) |
获取基于指定 VirtualPath 属性和 ResourceKey 属性的页面级资源对象。 |
| GetLocalResourceObject(String, String, CultureInfo) |
获取基于指定VirtualPath属性和ResourceKeyCultureInfo对象的页面级资源对象。 |
GetLocalResourceObject(String, String)
获取基于指定 VirtualPath 属性和 ResourceKey 属性的页面级资源对象。
public:
static System::Object ^ GetLocalResourceObject(System::String ^ virtualPath, System::String ^ resourceKey);
public static object GetLocalResourceObject(string virtualPath, string resourceKey);
static member GetLocalResourceObject : string * string -> obj
Public Shared Function GetLocalResourceObject (virtualPath As String, resourceKey As String) As Object
参数
- virtualPath
- String
VirtualPath本地资源对象的属性。
- resourceKey
- String
表示所请求资源对象的属性的字符串 ResourceKey 。
返回
一个 Object 表示请求的页面级资源对象;否则, null 如果找到匹配的资源对象,但找不到 resourceKey 参数。
例外
找不到指定 virtualPath 参数的资源对象。
指定的 virtualPath 参数不在当前应用程序的根目录中。
找不到页面的资源类。
注解
该方法 GetLocalResourceObject 使用属性中指定的 CurrentUICulture 区域性返回本地资源。
另请参阅
适用于
GetLocalResourceObject(String, String, CultureInfo)
获取基于指定VirtualPath属性和ResourceKeyCultureInfo对象的页面级资源对象。
public:
static System::Object ^ GetLocalResourceObject(System::String ^ virtualPath, System::String ^ resourceKey, System::Globalization::CultureInfo ^ culture);
public static object GetLocalResourceObject(string virtualPath, string resourceKey, System.Globalization.CultureInfo culture);
static member GetLocalResourceObject : string * string * System.Globalization.CultureInfo -> obj
Public Shared Function GetLocalResourceObject (virtualPath As String, resourceKey As String, culture As CultureInfo) As Object
参数
- virtualPath
- String
VirtualPath本地资源对象的属性。
- resourceKey
- String
表示所请求资源对象的属性的字符串 ResourceKey 。
- culture
- CultureInfo
一个表示 CultureInfo 所请求资源对象的对象的字符串。
返回
表示 Object 所请求的本地资源对象,该对象已针对指定的区域性进行本地化;否则 null ,如果找到匹配的资源对象,但找不到 resourceKey 参数。
例外
找不到指定 virtualPath 参数的资源对象。
指定的 virtualPath 参数不在当前应用程序的根目录中。
找不到页面的资源类。
注解
如果此区域性的资源未本地化,则查找将遵循回退过程来查找适当的资源。 有关详细信息,请参阅 打包和部署资源。