Export (0) Print
Expand All

ResourceManager.GetObject Method (String)

Returns the value of the specified Object resource.

Namespace: System.Resources
Assembly: mscorlib (in mscorlib.dll)

public virtual Object GetObject (
	string name
)
public Object GetObject (
	String name
)
public function GetObject (
	name : String
) : Object

Parameters

name

The name of the resource to get.

Return Value

The value of the resource localized for the caller's current culture settings. If a match is not possible, a null reference (Nothing in Visual Basic) is returned. The resource value can be a null reference (Nothing in Visual Basic).

Exception typeCondition

ArgumentNullException

The name parameter is a null reference (Nothing in Visual Basic).

MissingManifestResourceException

No usable set of resources has been found, and there are no neutral culture resources.

The returned resource is localized for the culture determined by the current cultural settings of the current Thread (this is accomplished using the culture's CurrentUICulture property). If the resource has not been localized for that culture, the resource that is returned is localized for a best match (this is accomplished using the Parent property). Otherwise, a null reference (Nothing in Visual Basic) is returned.

If no usable set of resources has been found, the ResourceManager falls back on the neutral culture's resources, which are expected to be included in the main assembly. If an appropriate culture resource has not been found, a MissingManifestResourceException is thrown.

NoteNote

The GetObject method is thread-safe.

Performance Considerations

If you call the GetObject method multiple times with the same name parameter, do not depend on the return value being a reference to the same object. This is because the GetObject method can return a reference to an existing resource object in a cache, or can reload the resource and return a reference to a new resource object.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft