SettingsSection.ParseTypedPrefixedValue Method

Gets the parsed type and value of a configuration setting value.

Definition

Namespace: Gemstone.Configuration
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.128 -- Release Build+d050cfc5563c89a1188cc3c6b2d417530856f490
public static (Type type, Object value) ParseTypedPrefixedValue(
	string? setting
)

Parameters

setting  String
Configuration setting value that can be prefixed with a type.

Return Value

ValueTuple<Type, Object>
Tuple containing the parsed type and, value.

Remarks

Type name is parsed from the beginning of the setting value, if it exists, and is enclosed in brackets, e.g.: [int]:123 or [System.Int32]:123. If no type name is specified, the assumed default type will always be String.

Common C# names like long and DateTime can be used as type names as well as custom type names. Custom type names require the full type name with a namespace, e.g.: [MyNamespace.MyType]:TypeValue. Type name lookups are not case-sensitive.

Exceptions

InvalidOperationExceptionFailed to load specified type.
TypeLoadExceptionFailed to load type.

See Also