Show / Hide Table of Contents

Class ConcurrentSet<T>

A concurrent, simplified HashSet.

Inheritance
Object
ConcurrentSet<T>
Implements
ICollection<T>
IEnumerable<T>
IEnumerable
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: Makaretu.Dns.Resolving
Assembly: Makaretu.Dns.dll
Syntax
public sealed class ConcurrentSet<T> : ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
Name Description
T
Remarks

This is a copy and paste of https://github.com/dotnet/roslyn/blob/master/src/Compilers/Core/Portable/InternalUtilities/ConcurrentSet.cs taken on 18 July 2018.

Constructors

| Improve this Doc View Source

ConcurrentSet()

Construct a concurrent set with the default concurrency level.

Declaration
public ConcurrentSet()
| Improve this Doc View Source

ConcurrentSet(IEnumerable<T>)

Construct a concurrent set using the specified the sequence.

Declaration
public ConcurrentSet(IEnumerable<T> values)
Parameters
Type Name Description
IEnumerable<T> values
| Improve this Doc View Source

ConcurrentSet(IEqualityComparer<T>)

Construct a concurrent set using the specified equality comparer.

Declaration
public ConcurrentSet(IEqualityComparer<T> equalityComparer)
Parameters
Type Name Description
IEqualityComparer<T> equalityComparer

The equality comparer for values in the set.

Properties

| Improve this Doc View Source

Count

Obtain the number of elements in the set.

Declaration
public int Count { get; }
Property Value
Type Description
Int32

The number of elements in the set.

| Improve this Doc View Source

IsEmpty

Determine whether the set is empty.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
Boolean

true if the set is empty; otherwise, false.

| Improve this Doc View Source

IsReadOnly

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
Boolean

Methods

| Improve this Doc View Source

Add(T)

Attempts to add a value to the set.

Declaration
public bool Add(T value)
Parameters
Type Name Description
T value

The value to add.

Returns
Type Description
Boolean

true if the value was added to the set. If the value already exists, this method returns false.

| Improve this Doc View Source

AddRange(IEnumerable<T>)

Add a sequence to the set.

Declaration
public void AddRange(IEnumerable<T> values)
Parameters
Type Name Description
IEnumerable<T> values
| Improve this Doc View Source

Clear()

Clear the set

Declaration
public void Clear()
| Improve this Doc View Source

Contains(T)

Determine whether the given value is in the set.

Declaration
public bool Contains(T value)
Parameters
Type Name Description
T value

The value to test.

Returns
Type Description
Boolean

true if the set contains the specified value; otherwise, false.

| Improve this Doc View Source

CopyTo(T[], Int32)

Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type Name Description
T[] array
Int32 arrayIndex
| Improve this Doc View Source

GetEnumerator()

Obtain an enumerator that iterates through the elements in the set.

Declaration
public ConcurrentSet<T>.KeyEnumerator GetEnumerator()
Returns
Type Description
ConcurrentSet.KeyEnumerator<>

An enumerator for the set.

| Improve this Doc View Source

Remove(T)

Attempts to remove a value from the set.

Declaration
public bool Remove(T value)
Parameters
Type Name Description
T value

The value to remove.

Returns
Type Description
Boolean

true if the value was removed successfully; otherwise false.

Explicit Interface Implementations

| Improve this Doc View Source

ICollection<T>.Add(T)

Declaration
void ICollection<T>.Add(T item)
Parameters
Type Name Description
T item
| Improve this Doc View Source

IEnumerable<T>.GetEnumerator()

Declaration
IEnumerator<T> IEnumerable<T>.GetEnumerator()
Returns
Type Description
IEnumerator<T>
| Improve this Doc View Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
IEnumerator

Implements

System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX