DictionaryExtensionsGetActualValueOrDefaultTKey, TValue, TActualValue(IDictionaryTKey, TValue, TKey, FuncTActualValue) Method
Namespace: KGySoft.CoreLibrariesAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
public static TActualValue GetActualValueOrDefault<TKey, TValue, TActualValue>(
this IDictionary<TKey, TValue> dictionary,
TKey key,
Func<TActualValue> defaultValueFactory
)
where TActualValue : TValue
<ExtensionAttribute>
Public Shared Function GetActualValueOrDefault(Of TKey, TValue, TActualValue As TValue) (
dictionary As IDictionary(Of TKey, TValue),
key As TKey,
defaultValueFactory As Func(Of TActualValue)
) As TActualValue
public:
[ExtensionAttribute]
generic<typename TKey, typename TValue, typename TActualValue>
where TActualValue : TValue
static TActualValue GetActualValueOrDefault(
IDictionary<TKey, TValue>^ dictionary,
TKey key,
Func<TActualValue>^ defaultValueFactory
)
[<ExtensionAttribute>]
static member GetActualValueOrDefault :
dictionary : IDictionary<'TKey, 'TValue> *
key : 'TKey *
defaultValueFactory : Func<'TActualValue> -> 'TActualValue when 'TActualValue : 'TValue
- dictionary IDictionaryTKey, TValue
- The dictionary.
- key TKey
- The key whose value to get.
- defaultValueFactory FuncTActualValue
- A delegate that can be invoked to return a default value if key was not found.
- TKey
- The type of the stored keys in the dictionary.
- TValue
- Type of the stored values in the dictionary.
- 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.In Visual Basic and C#, you can call this method as an instance method on any object of type
IDictionaryTKey,
TValue. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).