/// <summary> /// Adds a key/value pair to the concurrent dictionary if the key does not already exist. /// Returns the new value, or the existing value if the key already exists. /// </summary> public static TValue GetOrAdd <TArg>(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary, TKey key, Func <TKey, TArg, TValue> valueFactory, TArg factoryArgument) { Helper.Interleave(); return(concurrentDictionary.GetOrAdd(key, valueFactory, factoryArgument)); }
/// <summary> /// Adds a key/value pair to the concurrent dictionary if the key does not already exist. /// Returns the new value, or the existing value if the key already exists. /// </summary> public static TValue GetOrAdd(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary, TKey key, TValue value) { Helper.Interleave(); return(concurrentDictionary.GetOrAdd(key, value)); }