Bewerken

Delen via


ResourceManager.GetObject Method

Definition

Returns the value of the specified non-string resource for the current culture.

Overloads

GetObject(String)

Returns the value of the specified non-string resource.

GetObject(String, CultureInfo)

Gets the value of the specified non-string resource localized for the specified culture.

GetObject(String)

Source:
ResourceManager.cs
Source:
ResourceManager.cs
Source:
ResourceManager.cs

Returns the value of the specified non-string resource.

public:
 virtual System::Object ^ GetObject(System::String ^ name);
public virtual object? GetObject (string name);
public virtual object GetObject (string name);
abstract member GetObject : string -> obj
override this.GetObject : string -> obj
Public Overridable Function GetObject (name As String) As Object

Parameters

name
String

The name of the resource to get.

Returns

The value of the resource localized for the caller's current culture settings. If an appropriate resource set exists but name cannot be found, the method returns null.

Exceptions

The name parameter is null.

No usable set of localized resources has been found, and there are no default culture resources. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

The default culture's resources reside in a satellite assembly that could not be found. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

Remarks

For more information about this API, see Supplemental API remarks for ResourceManager.GetObject.

See also

Applies to

GetObject(String, CultureInfo)

Source:
ResourceManager.cs
Source:
ResourceManager.cs
Source:
ResourceManager.cs

Gets the value of the specified non-string resource localized for the specified culture.

public:
 virtual System::Object ^ GetObject(System::String ^ name, System::Globalization::CultureInfo ^ culture);
public virtual object? GetObject (string name, System.Globalization.CultureInfo? culture);
public virtual object GetObject (string name, System.Globalization.CultureInfo culture);
abstract member GetObject : string * System.Globalization.CultureInfo -> obj
override this.GetObject : string * System.Globalization.CultureInfo -> obj
Public Overridable Function GetObject (name As String, culture As CultureInfo) As Object

Parameters

name
String

The name of the resource to get.

culture
CultureInfo

The culture for which the resource is localized. If the resource is not localized for this culture, the resource manager uses fallback rules to locate an appropriate resource.

If this value is null, the CultureInfo object is obtained by using the CurrentUICulture property.

Returns

The value of the resource, localized for the specified culture. If an appropriate resource set exists but name cannot be found, the method returns null.

Exceptions

The name parameter is null.

No usable set of resources have been found, and there are no default culture resources. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

The default culture's resources reside in a satellite assembly that could not be found. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

Remarks

For more information about this API, see Supplemental API remarks for ResourceManager.GetObject.

Thread Safety

The GetObject(String, CultureInfo) method is thread safe.

See also

Applies to