/// <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<T>" /> /// <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); } }
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));
/// <inheritdoc /> public void Remove(LinkedListNode <T> node) { lock (Sync) InternalSource.Remove(node); }
/// <inheritdoc /> public bool SetEquals(IEnumerable <T> other) { lock (Sync) return(InternalSource.SetEquals(other)); }
/// <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));
/// <inheritdoc /> public void ExceptWith(IEnumerable <T> other) { lock (Sync) InternalSource.ExceptWith(other); }
/// <inheritdoc /> public void SymmetricExceptWith(IEnumerable <T> other) => Sync.Write(() => InternalSource.SymmetricExceptWith(other));
/// <inheritdoc /> public void SymmetricExceptWith(IEnumerable <T> other) { lock (Sync) InternalSource.SymmetricExceptWith(other); }
// 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);
/// <inheritdoc /> public void RemoveLast() { lock (Sync) InternalSource.RemoveLast(); }
/// <inheritdoc /> public void IntersectWith(IEnumerable <T> other) { lock (Sync) InternalSource.IntersectWith(other); }
/// <inheritdoc /> public virtual void Clear() => InternalSource.Clear();
/// <inheritdoc /> public void UnionWith(IEnumerable <T> other) { lock (Sync) InternalSource.UnionWith(other); }
/// <inheritdoc /> public virtual bool Remove(T item) => InternalSource.Remove(item);
/// <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));
/// <inheritdoc /> public override bool IfNotContains(T item, Action <HashSet <T> > action) => !InternalSource.Contains(item) && base.IfNotContains(item, action);
/// <inheritdoc /> public void AddLast(LinkedListNode <T> newNode) { lock (Sync) InternalSource.AddLast(newNode); }