GetObject Method (String)
Collapse the table of content
Expand the table of content

ResourceManager.GetObject Method (String)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Returns the value of the specified Object resource.

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

'Declaration
Public Overridable Function GetObject ( _
	name As String _
) As Object

Parameters

name
Type: System.String
The name of the resource to get.

Return Value

Type: System.Object
The value of the resource localized for the caller's current culture settings. If a match is not possible, Nothing is returned. The resource value can be Nothing.

ExceptionCondition
ArgumentNullException

The name parameter is Nothing.

MissingManifestResourceException

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

NotSupportedException

The resource depends on serialization.

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, Nothing 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.

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.

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 Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft