DictionaryExtensions.GetOrAddNonNull<TKey,TValue> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or adds the value associated with specified key.
public static TValue GetOrAddNonNull<TKey,TValue> (this System.Collections.Concurrent.ConcurrentDictionary<TKey,TValue> dictionary, TKey key, Func<TKey,TValue> valueFactory) where TValue : class;
static member GetOrAddNonNull : System.Collections.Concurrent.ConcurrentDictionary<'Key, 'Value (requires 'Value : null)> * 'Key * Func<'Key, 'Value (requires 'Value : null)> -> 'Value (requires 'Value : null)
<Extension()>
Public Function GetOrAddNonNull(Of TKey, TValue) (dictionary As ConcurrentDictionary(Of TKey, TValue), key As TKey, valueFactory As Func(Of TKey, TValue)) As TValue
Type Parameters
- TKey
The type of the key parameter.
- TValue
The type of the value parameter.
Parameters
- dictionary
- ConcurrentDictionary<TKey,TValue>
The dictionary containing the specified key.
- key
- TKey
The key whose value to get.
- valueFactory
- Func<TKey,TValue>
The value provider function.
Returns
TValue
The value associated with the specified key, if the key is found; otherwise the default value for the type of the value parameter.
Applies to
Collabora con noi su GitHub
L'origine di questo contenuto è disponibile in GitHub, in cui è anche possibile creare ed esaminare i problemi e le richieste pull. Per ulteriori informazioni, vedere la guida per i collaboratori.