/// <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)); }
/// <summary> /// Gets a value that indicates whether the concurrent dictionary is empty. /// </summary> #pragma warning disable CA1707 // Identifiers should not contain underscores #pragma warning disable SA1300 // Element should begin with upper-case letter #pragma warning disable IDE1006 // Naming Styles public static bool get_IsEmpty(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary) #pragma warning restore IDE1006 // Naming Styles #pragma warning restore SA1300 // Element should begin with upper-case letter #pragma warning restore CA1707 // Identifiers should not contain underscores { Helper.Interleave(); return(concurrentDictionary.IsEmpty); }
/// <summary> /// Sets the value associated with the specified key. /// </summary> #pragma warning disable CA1707 // Identifiers should not contain underscores #pragma warning disable SA1300 // Element should begin with upper-case letter #pragma warning disable IDE1006 // Naming Styles public static void set_Item(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary, TKey key, TValue value) #pragma warning restore IDE1006 // Naming Styles #pragma warning restore SA1300 // Element should begin with upper-case letter #pragma warning restore CA1707 // Identifiers should not contain underscores { Helper.Interleave(); concurrentDictionary[key] = value; }
/// <summary> /// Updates the value associated with key to newValue if the existing value with key is equal to comparisonValue. /// </summary> public static bool TryUpdate(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary, TKey key, TValue newValue, TValue comparisonValue) { Helper.Interleave(); return(concurrentDictionary.TryUpdate(key, newValue, comparisonValue)); }
/// <summary> /// Attempts to remove and return the value that has the specified key /// from the concurrent dictionary. /// </summary> public static bool TryRemove(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary, SystemGenerics.KeyValuePair <TKey, TValue> item) { Helper.Interleave(); return(concurrentDictionary.TryRemove(item)); }
/// <summary> /// Attempts to remove and return the value that has the specified key /// from the concurrent dictionary. /// </summary> public static bool TryRemove(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary, TKey key, out TValue value) { Helper.Interleave(); return(concurrentDictionary.TryRemove(key, out value)); }
/// <summary> /// Copies the key and value pairs stored in the concurrent dictionary to a new array. /// </summary> public static SystemGenerics.KeyValuePair <TKey, TValue>[] ToArray( SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary) { Helper.Interleave(); return(concurrentDictionary.ToArray()); }
/// <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)); }
/// <summary> /// Returns an enumerator that iterates through the concurrent dictionary. /// </summary> public static SystemGenerics.IEnumerator <SystemGenerics.KeyValuePair <TKey, TValue> > GetEnumerator( SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary) { Helper.Interleave(); return(concurrentDictionary.GetEnumerator()); }
/// <summary> /// Determines whether the concurrent dictionary contains the specified key. /// </summary> public static bool ContainsKey(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary, TKey key) { Helper.Interleave(); return(concurrentDictionary.ContainsKey(key)); }
/// <summary> /// Removes all keys and values from the concurrent dictionary. /// </summary> public static void Clear(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary) { Helper.Interleave(); concurrentDictionary.Clear(); }
/// <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)); }