Click or drag to resize
JsonObjectGetOrDefaultTJsonValue Method (String, TJsonValue)
Gets value stored under given key and casts it to desired type. If not such member exists than defaultValue is returned.

Namespace: Dextronet.Jsonie
Assembly: Dextronet.Jsonie (in Dextronet.Jsonie.dll) Version: 1.0.0.0
Syntax
public TJsonValue GetOrDefault<TJsonValue>(
	string key,
	TJsonValue defaultValue = null
)
where TJsonValue : JsonValue

Parameters

key
Type: SystemString
The key under which is object stored.
defaultValue (Optional)
Type: TJsonValue
Default value returned in case no such member exists.

Type Parameters

TJsonValue
Desired type of value.

Return Value

Type: TJsonValue
Value stored under given key casted to TJsonValue.
Exceptions
ExceptionCondition
ArgumentNullExceptionkey is null.
InvalidCastExceptionIf property with given key exist and is not of given type TJsonValue.
See Also