IStringKeyedDictionaryTValueGetValueOrDefaultTActualValue(ReadOnlySpanChar, 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: 10.0.0
TActualValue GetValueOrDefault<TActualValue>(
ReadOnlySpan<char> key,
TActualValue defaultValue = null
)
where TActualValue : TValue
Function GetValueOrDefault(Of TActualValue As TValue) (
key As ReadOnlySpan(Of Char),
Optional defaultValue As TActualValue = Nothing
) As TActualValue
generic<typename TActualValue>
where TActualValue : TValue
TActualValue GetValueOrDefault(
ReadOnlySpan<wchar_t> key,
TActualValue defaultValue = nullptr
)
abstract GetValueOrDefault :
key : ReadOnlySpan<char> *
?defaultValue : 'TActualValue
(* Defaults:
let _defaultValue = defaultArg defaultValue null
*)
-> 'TActualValue when 'TActualValue : 'TValue
- key ReadOnlySpanChar
- 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.
This member is available only in .NET Core 2.1/.NET Standard 2.1 and above.