DynamicResourceManagerGetObject(String, CultureInfo) Method

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

Definition

Namespace: KGySoft.Resources
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public override Object? GetObject(
	string name,
	CultureInfo? culture
)

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 , the CultureInfo object is obtained by using the DisplayLanguage property.

Return Value

Object
If SafeMode is , and the resource is from a .resx content, then the method returns a ResXDataNode instance instead of the actual deserialized value. Otherwise, returns the value of the resource localized for the specified culture, or if name cannot be found in a resource set.

Implements

IExpandoResourceManagerGetObject(String, CultureInfo)

Remarks

Depending on the value of the CloneValues property, the GetObject methods return either a full copy of the specified resource, or always the same instance. For memory streams and byte arrays none of them are ideal because a full copy duplicates the inner buffer of a possibly large array of bytes, whereas returning the same stream instance can cause issues with conflicting positions or disposed state. Therefore the GetStream methods can be used to obtain a new read-only MemoryStream wrapper around the same internal buffer, regardless the current value of the CloneValues property.

String values are not duplicated in memory, regardless the value of the CloneValues property.

Depending on the value of the AutoAppend property, dynamic expansion of the resource sets of different cultures may occur when calling this method.

  Note

For more details see the Auto Appending section at the description of the DynamicResourceManager class.

Exceptions

ArgumentNullExceptionname is .
ObjectDisposedExceptionThe DynamicResourceManager is already disposed.
MissingManifestResourceExceptionNo 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 notes under Instantiating a ResXResourceManager object section of the description of the ResXResourceManager class.

See Also