Exemplo n.º 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));
 }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 4
0
 /// <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));
 }
Exemplo n.º 5
0
 /// <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));
 }
Exemplo n.º 6
0
 /// <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));
 }
Exemplo n.º 7
0
 /// <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());
 }
Exemplo n.º 8
0
 /// <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));
 }
Exemplo n.º 9
0
 /// <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));
 }
Exemplo n.º 10
0
 /// <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());
 }
Exemplo n.º 11
0
 /// <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));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Removes all keys and values from the concurrent dictionary.
 /// </summary>
 public static void Clear(SystemConcurrent.ConcurrentDictionary <TKey, TValue> concurrentDictionary)
 {
     Helper.Interleave();
     concurrentDictionary.Clear();
 }
Exemplo n.º 13
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));
 }