예제 #1
0
 /// <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;
 }
예제 #2
0
 /// <summary>
 ///     Removes all the elements.
 /// </summary>
 public void Clear()
 {
     _bucket = new Bucket <T>();
 }
예제 #3
0
 /// <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>();
 }
예제 #4
0
 /// <inheritdoc />
 /// <summary>
 ///     Removes all the elements.
 /// </summary>
 public void Clear()
 {
     _wrapped = new Bucket <T>();
 }
예제 #5
0
 /// <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>()));
 }