コード例 #1
0
 /// <summary>
 /// Adds a key/value pair to the concurrent dictionary if the key does not
 /// already exist, or updates a key/value pair in the concurrent dictionary
 /// if the key already exists.
 /// </summary>
 public static TValue AddOrUpdate <TArg>(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary,
                                         TKey key, Func <TKey, TArg, TValue> addValueFactory, Func <TKey, TValue, TArg, TValue> updateValueFactory,
                                         TArg factoryArgument)
 {
     Helper.Interleave();
     return(concurrentDictionary.AddOrUpdate(key, addValueFactory, updateValueFactory, factoryArgument));
 }
コード例 #2
0
 /// <summary>
 /// Adds a key/value pair to the concurrent dictionary if the key does not
 /// already exist, or updates a key/value pair in the concurrent dictionary
 /// if the key already exists.
 /// </summary>
 public static TValue AddOrUpdate(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary,
                                  TKey key, TValue addValue, Func <TKey, TValue, TValue> updateValueFactory)
 {
     Helper.Interleave();
     return(concurrentDictionary.AddOrUpdate(key, addValue, updateValueFactory));
 }