This documentation is archived and is not being maintained.

ResourceManager.GetObject Method (String, CultureInfo)

Gets the value of the Object resource localized for the specified culture.

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

public virtual Object GetObject (
	string name,
	CultureInfo culture
public Object GetObject (
	String name, 
	CultureInfo culture
public function GetObject (
	name : String, 
	culture : CultureInfo
) : Object
Not applicable.



The name of the resource to get.


The CultureInfo object that represents the culture for which the resource is localized. Note that if the resource is not localized for this culture, the lookup will fall back using the culture's Parent property, stopping after checking in the neutral culture.

If this value is a null reference (Nothing in Visual Basic), the CultureInfo is obtained using the culture's CurrentUICulture property.

Return Value

The value of the resource, localized for the specified culture. If a "best match" is not possible, a null reference (Nothing in Visual Basic) is returned.

Exception typeCondition


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


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

If the resource has not been localized for the specified culture, the resource that is returned is localized for a best match (this is accomplished using the culture's 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.


The GetObject method is thread-safe.

Caution noteCaution:

This method can throw more exceptions than are listed. One reason this might occur is if a method that this method calls throws an exception. For example, a FileLoadException might be thrown if an error was made deploying or installing a satellite assembly, or a SerializationException might be thrown if a user-defined type throws a user-defined exception when the type is deserialized.

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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0