IExpandoResourceManagerGetMetaObject Method

Returns the value of the specified non-string metadata for the specified culture.

Definition

Namespace: KGySoft.Resources
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
C#
Object? GetMetaObject(
	string name,
	CultureInfo? culture = null
)

Parameters

name  String
The name of the metadata to retrieve.
culture  CultureInfo  (Optional)
An object that represents the culture for which the metadata should be returned. If this value is , the CultureInfo object is obtained by using the CultureInfo.InvariantCulture property. Unlike in case of GetObject method, no fallback is used if the metadata is not found in the specified culture. This parameter is optional.
Default value: .

Return Value

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

Remarks

Depending on the value of the CloneValues property, the GetMetaObject method returns either a full copy of the specified metadata, 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 GetMetaStream method 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.

Exceptions

ArgumentNullExceptionname is .
ObjectDisposedExceptionThe IExpandoResourceManager 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