/// <summary>
 /// Adds mutliple items to the collection.
 /// It's important to avoid locking for too long so an array is used to add multiple items.
 /// An enumerable is potentially slow as it may be yielding to a process.
 /// </summary>
 /// <param name="items">The items to add.</param>
 public virtual void Add(T[] items)
 {
     foreach (var i in items)
     {
         InternalSource.Add(i);
     }
 }
 /// <inheritdoc cref="ICollection&lt;T&gt;" />
 /// <param name="item1">First item to add.</param>
 /// <param name="item2">Additional item to add.</param>
 /// <param name="items">Extended param items to add.</param>
 public virtual void Add(T item1, T item2, params T[] items)
 {
     InternalSource.Add(item1);
     InternalSource.Add(item2);
     foreach (var i in items)
     {
         InternalSource.Add(i);
     }
 }
Example #3
0
        private static Source Source(Stream @in, Timeout timeout)
        {
            if (@in == null)
            {
                throw new ArgumentException("in == null");
            }
            if (timeout == null)
            {
                throw new ArgumentException("timeout == null");
            }
            var internalSource = new InternalSource(@in, timeout);

            return(internalSource);
        }
 /// <inheritdoc />
 public bool Overlaps(IEnumerable <T> other) => Sync.ReadValue(() => InternalSource.Overlaps(other));
 /// <inheritdoc />
 public bool IsSupersetOf(IEnumerable <T> other) => Sync.ReadValue(() => InternalSource.IsSupersetOf(other));
Example #6
0
 /// <inheritdoc />
 public void Remove(LinkedListNode <T> node)
 {
     lock (Sync) InternalSource.Remove(node);
 }
Example #7
0
 /// <inheritdoc />
 public bool SetEquals(IEnumerable <T> other)
 {
     lock (Sync) return(InternalSource.SetEquals(other));
 }
Example #8
0
 /// <inheritdoc />
 public bool IsSupersetOf(IEnumerable <T> other)
 {
     lock (Sync) return(InternalSource.IsSupersetOf(other));
 }
 /// <inheritdoc />
 public void UnionWith(IEnumerable <T> other) => Sync.Write(() => InternalSource.UnionWith(other));
 /// <inheritdoc />
 public void RemoveLast() => Sync.Write(() => InternalSource.RemoveLast());
 /// <inheritdoc />
 public virtual void Add(T item) => InternalSource.Add(item);
 /// <inheritdoc />
 public void AddLast(LinkedListNode <T> newNode) => Sync.Write(() => InternalSource.AddLast(newNode));
 /// <inheritdoc />
 public void Remove(LinkedListNode <T> node) => Sync.Write(() => InternalSource.Remove(node));
 /// <inheritdoc />
 public LinkedListNode <T> AddLast(T item) => Sync.WriteValue(() => InternalSource.AddLast(item));
 /// <inheritdoc />
 public void AddBefore(LinkedListNode <T> node, LinkedListNode <T> newNode) => Sync.Write(() => InternalSource.AddBefore(node, newNode));
 /// <inheritdoc />
 public LinkedListNode <T> AddBefore(LinkedListNode <T> node, T item) => Sync.WriteValue(() => InternalSource.AddBefore(node, item));
 /// <inheritdoc />
 public bool SetEquals(IEnumerable <T> other) => Sync.ReadValue(() => InternalSource.SetEquals(other));
Example #18
0
 /// <inheritdoc />
 public void ExceptWith(IEnumerable <T> other)
 {
     lock (Sync) InternalSource.ExceptWith(other);
 }
 /// <inheritdoc />
 public void SymmetricExceptWith(IEnumerable <T> other) => Sync.Write(() => InternalSource.SymmetricExceptWith(other));
Example #20
0
 /// <inheritdoc />
 public void SymmetricExceptWith(IEnumerable <T> other)
 {
     lock (Sync) InternalSource.SymmetricExceptWith(other);
 }
Example #21
0
        // Asumes that .Contains is a thread-safe read-only operation.
        // But any potentially iterative operation will be locked.

        /// <inheritdoc />
        public override bool Contains(T item) => InternalSource.Contains(item);
Example #22
0
 /// <inheritdoc />
 public void RemoveLast()
 {
     lock (Sync) InternalSource.RemoveLast();
 }
Example #23
0
 /// <inheritdoc />
 public void IntersectWith(IEnumerable <T> other)
 {
     lock (Sync) InternalSource.IntersectWith(other);
 }
 /// <inheritdoc />
 public virtual void Clear() => InternalSource.Clear();
Example #25
0
 /// <inheritdoc />
 public void UnionWith(IEnumerable <T> other)
 {
     lock (Sync) InternalSource.UnionWith(other);
 }
 /// <inheritdoc />
 public virtual bool Remove(T item) => InternalSource.Remove(item);
Example #27
0
 /// <inheritdoc />
 public bool Overlaps(IEnumerable <T> other)
 {
     lock (Sync) return(InternalSource.Overlaps(other));
 }
 /// <inheritdoc />
 public void IntersectWith(IEnumerable <T> other) => Sync.Write(() => InternalSource.IntersectWith(other));
Example #29
0
 /// <inheritdoc />
 public override bool IfNotContains(T item, Action <HashSet <T> > action) => !InternalSource.Contains(item) && base.IfNotContains(item, action);
Example #30
0
 /// <inheritdoc />
 public void AddLast(LinkedListNode <T> newNode)
 {
     lock (Sync) InternalSource.AddLast(newNode);
 }