HttpContext.GetLocalResourceObject HttpContext.GetLocalResourceObject HttpContext.GetLocalResourceObject HttpContext.GetLocalResourceObject Method

定義

取得頁面層級資源。Gets a page-level resource.

多載

GetLocalResourceObject(String, String) GetLocalResourceObject(String, String) GetLocalResourceObject(String, String) GetLocalResourceObject(String, String)

根據指定的 VirtualPathResourceKey 屬性,取得頁面層級資源物件。Gets a page-level resource object based on the specified VirtualPath and ResourceKey properties.

GetLocalResourceObject(String, String, CultureInfo) GetLocalResourceObject(String, String, CultureInfo) GetLocalResourceObject(String, String, CultureInfo) 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) GetLocalResourceObject(String, String) GetLocalResourceObject(String, String) 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 String String String

本機資源物件的 VirtualPath 屬性。The VirtualPath property for the local resource object.

resourceKey
String String String String

字串,代表所要求之資源物件的 ResourceKey 屬性A string that represents a ResourceKey property of the requested resource 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.

備註

方法會使用CurrentUICulture屬性中所指定的文化特性, 傳回本機資源。 GetLocalResourceObjectThe GetLocalResourceObject method returns a local resource by using the culture that is specified in the CurrentUICulture property.

另請參閱

GetLocalResourceObject(String, String, CultureInfo) GetLocalResourceObject(String, String, CultureInfo) GetLocalResourceObject(String, String, CultureInfo) 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 String String String

本機資源物件的 VirtualPath 屬性。The VirtualPath property for the local 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.

傳回

Object,表示要求的本機資源物件 (已針對指定的文化特性當地語系化),如果找到相符的資源物件而非 resourceKey 參數,則為 nullAn 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.

另請參閱

適用於