IStringKeyedDictionaryTValueGetValueOrDefaultTActualValue(String, FuncTActualValue) Method
Tries to get the typed value from the dictionary for the given key.
The defaultValueFactory can return an instance of a more specific type than TValue.
Namespace: KGySoft.CollectionsAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
TActualValue GetValueOrDefault<TActualValue>(
string key,
Func<TActualValue> defaultValueFactory
)
where TActualValue : TValue
Function GetValueOrDefault(Of TActualValue As TValue) (
key As String,
defaultValueFactory As Func(Of TActualValue)
) As TActualValue
generic<typename TActualValue>
where TActualValue : TValue
TActualValue GetValueOrDefault(
String^ key,
Func<TActualValue>^ defaultValueFactory
)
abstract GetValueOrDefault :
key : string *
defaultValueFactory : Func<'TActualValue> -> 'TActualValue when 'TActualValue : 'TValue
- key String
- The key whose value to get.
- defaultValueFactory FuncTActualValue
- A delegate that can be invoked to return a default value if key was not found.
- TActualValue
- The type of the value with the corresponding key to get.
TActualValueThe found value or the result of
defaultValueFactory if
key was not found in the dictionary.