语言

HttpContext.GetGlobalResourceObject 方法

定义

获取应用程序级资源。

重载

名称 说明
GetGlobalResourceObject(String, String)

获取基于指定 ClassKey 属性和 ResourceKey 属性的应用程序级资源对象。

GetGlobalResourceObject(String, String, CultureInfo)

获取基于指定ClassKey属性和ResourceKeyCultureInfo对象的应用程序级资源对象。

GetGlobalResourceObject(String, String)

获取基于指定 ClassKey 属性和 ResourceKey 属性的应用程序级资源对象。

public:
 static System::Object ^ GetGlobalResourceObject(System::String ^ classKey, System::String ^ resourceKey);
public static object GetGlobalResourceObject(string classKey, string resourceKey);
static member GetGlobalResourceObject : string * string -> obj
Public Shared Function GetGlobalResourceObject (classKey As String, resourceKey As String) As Object

参数

classKey
String

一个表示 ClassKey 所请求资源对象的属性的字符串。

resourceKey
String

一个表示 ResourceKey 所请求资源对象的属性的字符串。

返回

一个 Object 表示所请求的应用程序级资源对象;否则,如果未找到资源对象或找到资源对象,但没有请求的属性,则为 null。

例外

找不到具有指定 classKey 参数的资源对象。

-或-

主程序集不包含中性区域性的资源,并且这些资源是必需的,因为缺少相应的附属程序集。

注解

该方法 GetGlobalResourceObject 使用属性中指定的 CurrentUICulture 区域性返回全局资源。

注释

在某些编辑环境中(如 Visual Web 开发人员),如果在全局资源键名称中使用句点 (.),编辑器可能会引发设计时 MissingManifestResourceException 异常。 但是,这不会影响编辑或保存文件的能力,你可以忽略错误。

另请参阅

适用于

GetGlobalResourceObject(String, String, CultureInfo)

获取基于指定ClassKey属性和ResourceKeyCultureInfo对象的应用程序级资源对象。

public:
 static System::Object ^ GetGlobalResourceObject(System::String ^ classKey, System::String ^ resourceKey, System::Globalization::CultureInfo ^ culture);
public static object GetGlobalResourceObject(string classKey, string resourceKey, System.Globalization.CultureInfo culture);
static member GetGlobalResourceObject : string * string * System.Globalization.CultureInfo -> obj
Public Shared Function GetGlobalResourceObject (classKey As String, resourceKey As String, culture As CultureInfo) As Object

参数

classKey
String

一个表示 ClassKey 所请求资源对象的属性的字符串。

resourceKey
String

表示所请求资源对象的属性的字符串 ResourceKey 。

culture
CultureInfo

一个表示 CultureInfo 所请求资源的对象的字符串。

返回

一个 Object 表示所请求的应用程序级资源对象,该对象已针对指定的区域性进行本地化;否则, null 如果未找到资源对象或找到资源对象,但该对象没有请求的属性。

例外

找不到指定 classKey 参数的资源对象。

-或-

主程序集不包含中性区域性的资源,并且这些资源是必需的,因为缺少相应的附属程序集。

注解

该 CultureInfo 对象表示资源的本地化区域性。 如果此区域性的资源未本地化,则查找将遵循回退过程来查找适当的资源。 有关详细信息,请参阅 打包和部署资源。

注释

在某些编辑环境中(如 Visual Web 开发人员),如果在全局资源键名称中使用句点 (.),编辑器可能会引发设计时 MissingManifestResourceException 异常。 但是,这不会影响编辑或保存文件的能力,你可以忽略错误。

另请参阅

适用于