Exemple #1
0
        private bool GetOrCreateValues(TKey key, IEnumerable <TValue> initial, out SyncedCollection <TValue> col)
        {
            // Return true when created
            var created = false;

            col = _dict.GetOrAdd(key, k =>
            {
                created = true;
                return(CreateCollection(initial));
            });

            return(created);
        }
Exemple #2
0
 /// <summary>
 /// Attempts to remove and return all values for the specified key.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <returns><c>True</c> if any such values existed; otherwise <c>false</c>.</returns>
 public virtual bool TryRemoveAll(TKey key, out SyncedCollection <TValue> collection)
 {
     return(_dict.TryRemove(key, out collection));
 }