HttpContext.GetGlobalResourceObject HttpContext.GetGlobalResourceObject HttpContext.GetGlobalResourceObject HttpContext.GetGlobalResourceObject Method

定義

取得應用程式層級資源。Gets an application-level resource.

多載

GetGlobalResourceObject(String, String) GetGlobalResourceObject(String, String) GetGlobalResourceObject(String, String) GetGlobalResourceObject(String, String)

根據指定的 ClassKeyResourceKey 屬性,取得應用程式層級資源物件。Gets an application-level resource object based on the specified ClassKey and ResourceKey properties.

GetGlobalResourceObject(String, String, CultureInfo) GetGlobalResourceObject(String, String, CultureInfo) GetGlobalResourceObject(String, String, CultureInfo) GetGlobalResourceObject(String, String, CultureInfo)

根據指定的 ClassKeyResourceKey 屬性及 CultureInfo 物件,取得應用程式層級資源物件。Gets an application-level resource object based on the specified ClassKey and ResourceKey properties, and on the CultureInfo object.

GetGlobalResourceObject(String, String) GetGlobalResourceObject(String, String) GetGlobalResourceObject(String, String) GetGlobalResourceObject(String, String)

根據指定的 ClassKeyResourceKey 屬性,取得應用程式層級資源物件。Gets an application-level resource object based on the specified ClassKey and ResourceKey properties.

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 String String String

字串,表示要求的資源物件之 ClassKey 屬性。A string that represents the ClassKey property of the requested resource object.

resourceKey
String String String String

字串,表示要求的資源物件之 ResourceKey 屬性。A string that represents the ResourceKey property of the requested resource object.

傳回

Object,表示要求的應用程式層級資源物件;如果找不到資源物件,或是已找到但其不具有要求的屬性,則為 null。An Object that represents the requested application-level resource object; otherwise, null if a resource object is not found or if a resource object is found but it does not have the requested property.

例外狀況

找不到具有指定之 classKey 參數的資源物件。A resource object with the specified classKey parameter was not found.

-或--or- 因為遺失適當的附屬組件,主要組件未包含中性文化特性的資源,而這些資源是必要的。The main assembly does not contain the resources for the neutral culture, and these resources are required because the appropriate satellite assembly is missing.

備註

方法會使用CurrentUICulture屬性中所指定的文化特性, 傳回全域資源。 GetGlobalResourceObjectThe GetGlobalResourceObject method returns a global resource by using the culture that is specified in the CurrentUICulture property.

注意

在某些編輯環境 (例如Visual Web DeveloperVisual Web Developer) 中, 如果您在全域資源索引鍵名稱中使用句號 (.), 編輯器可能會擲回設計階段MissingManifestResourceException例外狀況。In some editing environments, such as Visual Web DeveloperVisual Web Developer, the editor might throw a design-time MissingManifestResourceException exception if you use a period (.) in the global resource-key name. 不過, 這並不會影響您編輯或儲存檔案的能力, 而且您可以忽略此錯誤。However, this does not affect your ability to edit or save the file, and you can ignore the error.

另請參閱

GetGlobalResourceObject(String, String, CultureInfo) GetGlobalResourceObject(String, String, CultureInfo) GetGlobalResourceObject(String, String, CultureInfo) GetGlobalResourceObject(String, String, CultureInfo)

根據指定的 ClassKeyResourceKey 屬性及 CultureInfo 物件,取得應用程式層級資源物件。Gets an application-level resource object based on the specified ClassKey and ResourceKey properties, and on the CultureInfo object.

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 String String String

字串,表示要求的資源物件之 ClassKey 屬性。A string that represents the ClassKey property of the requested resource object.

resourceKey
String String String String

字串,代表所要求之資源物件的 ResourceKey 屬性。A string that represents a ResourceKey property of the requested resource object.

culture
CultureInfo CultureInfo CultureInfo CultureInfo

字串,表示要求之資源的 CultureInfo 物件。A string that represents the CultureInfo object of the requested resource.

傳回

Object,表示要求的應用程式層級資源物件 (已針對指定的文化特性當地語系化);如果找不到資源物件,或是已找到但其不具有要求的屬性,則為 nullAn Object that represents the requested application-level resource object, which is localized for the specified culture; otherwise, null if a resource object is not found or if a resource object is found but it does not have the requested property.

例外狀況

找不到有指定 classKey 參數的資源物件。A resource object for which the specified classKey parameter was not found.

-或--or- 因為遺失適當的附屬組件,主要組件未包含中性文化特性的資源,而這些資源是必要的。The main assembly does not contain the resources for the neutral culture, and these resources are required because the appropriate satellite assembly is missing.

備註

CultureInfo物件代表已當地語系化資源的文化特性。The CultureInfo object represents the culture for which the resource was localized. 如果此文化特性的資源未當地語系化, 則查閱會遵循回溯進程來尋找適當的資源。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.

注意

在某些編輯環境 (例如 Visual Web Developer) 中, 如果您在全域資源索引鍵MissingManifestResourceException名稱中使用句號 (.), 編輯器可能會擲回設計階段例外狀況。In some editing environments, such as Visual Web Developer, the editor might throw a design-time MissingManifestResourceException exception if you use a period (.) in the global resource-key name. 不過, 這並不會影響您編輯或儲存檔案的能力, 而且您可以忽略此錯誤。However, this does not affect your ability to edit or save the file, and you can ignore the error.

另請參閱

適用於