HttpContext.GetGlobalResourceObject 方法

定義

取得應用程式層級資源。

多載

GetGlobalResourceObject(String, String)

根據指定的 ClassKeyResourceKey 屬性,取得應用程式層級資源物件。

GetGlobalResourceObject(String, String, CultureInfo)

根據指定的 ClassKeyResourceKey 屬性以及 CultureInfo 物件,取得應用程式層級資源物件。

GetGlobalResourceObject(String, String)

根據指定的 ClassKeyResourceKey 屬性,取得應用程式層級資源物件。

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

Object,代表所要求的應用程式層級資源物件;如果找不到資源物件,或是已找到但其不具有所要求的屬性,則為 null。

例外狀況

找不到具有指定之 classKey 參數的資源物件。

-或-

因為遺失適當的附屬組件,主要組件未包含中性文化特性的資源,而這些資源是必要的。

備註

方法會 GetGlobalResourceObject 使用 屬性中指定的 CurrentUICulture 文化特性傳回全域資源。

注意

在某些編輯環境中,例如 Visual Web 開發人員,如果您在全域資源索引鍵名稱中使用期間 (.) ,編輯器可能會擲回設計階段 MissingManifestResourceException 例外狀況。 不過,這不會影響編輯或儲存檔案的能力,而且您可以忽略錯誤。

另請參閱

適用於

GetGlobalResourceObject(String, String, CultureInfo)

根據指定的 ClassKeyResourceKey 屬性以及 CultureInfo 物件,取得應用程式層級資源物件。

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

Object,代表所要求的應用程式層級資源物件 (已針對指定的文化特性當地語系化);如果找不到資源物件,或是已找到但其不具有所要求的屬性,則為 null

例外狀況

找不到有指定 classKey 參數的資源物件。

-或-

因為遺失適當的附屬組件,主要組件未包含中性文化特性的資源,而這些資源是必要的。

備註

物件 CultureInfo 代表資源當地語系化的文化特性。 如果資源未針對此文化特性當地語系化,則查閱會遵循後援程式來找出適當的資源。 如需詳細資訊,請參閱封裝和部署資源

注意

在某些編輯環境中,例如 Visual Web 開發人員,如果您在全域資源索引鍵名稱中使用期間 (.) ,編輯器可能會擲回設計階段 MissingManifestResourceException 例外狀況。 不過,這不會影響編輯或儲存檔案的能力,而且您可以忽略錯誤。

另請參閱

適用於