HttpContext.GetLocalResourceObject 方法

定义

获取页级别的资源。Gets a page-level resource.

重载

GetLocalResourceObject(String, String)

根据指定的 VirtualPathResourceKey 属性,获取页级别资源对象。Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties.

GetLocalResourceObject(String, String, CultureInfo)

根据指定的 VirtualPathResourceKey 属性以及 CultureInfo 对象,获取一个页级别资源对象。Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties, and on the CultureInfo object.

GetLocalResourceObject(String, String)

根据指定的 VirtualPathResourceKey 属性,获取页级别资源对象。Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties.

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 属性。The VirtualPath property for the local resource object.

resourceKey
String

一个字符串,表示所请求资源对象的 ResourceKey 属性A string that represents a ResourceKey property of the requested resource object

返回

Object

Object,表示请求的页级别资源对象;否则,如果找到了匹配的资源对象但不是 resourceKey 参数,则为 nullAn Object that represents the requested page-level resource object; otherwise, null if a matching resource object is found but not a resourceKey parameter.

例外

未找到具有指定 virtualPath 参数的资源对象。A resource object was not found for the specified virtualPath parameter.

指定的 virtualPath 参数不在当前应用程序的根目录中。The specified virtualPath parameter is not in the current application's root directory.

未找到页的资源类。The resource class for the page was not found.

注解

GetLocalResourceObject方法使用属性中指定的区域性返回本地资源 CurrentUICultureThe GetLocalResourceObject method returns a local resource by using the culture that is specified in the CurrentUICulture property.

另请参阅

适用于

产品 Introduced

GetLocalResourceObject(String, String, CultureInfo)

根据指定的 VirtualPathResourceKey 属性以及 CultureInfo 对象,获取一个页级别资源对象。Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties, and on the CultureInfo object.

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 属性。The VirtualPath property for the local resource object.

resourceKey
String

一个表示所请求资源对象的 ResourceKey 属性的字符串。A string that represents a ResourceKey property of the requested resource object.

culture
CultureInfo

一个字符串,表示所请求资源对象的 CultureInfo 对象。A string that represents the CultureInfo object of the requested resource object.

返回

Object

Object,表示请求的本地资源对象(针对指定区域性进行了本地化的对象);否则,如果找到了匹配的资源对象但不是 null 参数,则为 resourceKeyAn Object that represents the requested local resource object, which is localized for the specified culture; otherwise null if a matching resource object is found but not a resourceKey parameter.

例外

未找到具有指定 virtualPath 参数的资源对象。A resource object was not found for the specified virtualPath Parameter.

指定的 virtualPath 参数不在当前应用程序的根目录中。The specified virtualPath parameter is not in the current application's root directory.

未找到页的资源类。The resource class for the page was not found.

注解

如果没有为此区域性本地化该资源,则查找将遵循回退过程来定位相应的资源。If the resource is not localized for this culture, the lookup will follow a fallback process to locate an appropriate resource. 有关详细信息,请参阅打包和部署资源For more information, see Packaging and Deploying Resources.

另请参阅

适用于

产品 Introduced