/// <summary> /// Initializes a new instance of the <see cref="ThreadSafeSet{T}" /> class. /// </summary> /// <param name="comparer">The value comparer.</param> /// <param name="initialProbing">The number of steps in linear probing.</param> public ThreadSafeSet(IEqualityComparer <T> comparer, int initialProbing) { Comparer = comparer ?? EqualityComparer <T> .Default; _bucket = new Bucket <T>(); _probing = initialProbing; }
/// <summary> /// Removes all the elements. /// </summary> public void Clear() { _bucket = new Bucket <T>(); }
/// <summary> /// Initializes a new instance of the <see cref="ThreadSafeCollection{T}" /> class. /// </summary> /// <param name="comparer">The value comparer.</param> public ThreadSafeCollection(IEqualityComparer <T> comparer) { _maxIndex = -1; Comparer = comparer ?? EqualityComparer <T> .Default; _wrapped = new Bucket <T>(); }
/// <inheritdoc /> /// <summary> /// Removes all the elements. /// </summary> public void Clear() { _wrapped = new Bucket <T>(); }
/// <summary> /// Removes all the elements. /// </summary> /// <returns>Returns the removed pairs.</returns> public IEnumerable <T> ClearEnumerable() { return(Interlocked.Exchange(ref _bucket, _bucket = new Bucket <T>())); }