IStringKeyedDictionaryTValueGetValueOrDefaultTActualValue(StringSegment, TActualValue) Method
Tries to get the typed value from the dictionary for the given key.
The defaultValue parameter can have a more specific type than TValue.
Namespace: KGySoft.CollectionsAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
TActualValue GetValueOrDefault<TActualValue>(
StringSegment key,
TActualValue defaultValue = null
)
where TActualValue : TValue
Function GetValueOrDefault(Of TActualValue As TValue) (
key As StringSegment,
Optional defaultValue As TActualValue = Nothing
) As TActualValue
generic<typename TActualValue>
where TActualValue : TValue
TActualValue GetValueOrDefault(
StringSegment key,
TActualValue defaultValue = nullptr
)
abstract GetValueOrDefault :
key : StringSegment *
?defaultValue : 'TActualValue
(* Defaults:
let _defaultValue = defaultArg defaultValue null
*)
-> 'TActualValue when 'TActualValue : 'TValue
- key StringSegment
- The key whose value to get.
- defaultValue TActualValue (Optional)
- The default value to return if key was not found or its actual type
is not compatible with TActualValue. This parameter is optional.
Default value: if TActualValue is a reference type; otherwise, the bitwise zero value of TActualValue.
- TActualValue
- The type of the value with the corresponding key to get.
TActualValueThe found value or
defaultValue if
key was not found or its value cannot be cast to
TActualValue.