Show / Hide Table of Contents

Class ConcurrentSet<T>

Represents a thread-safe set of values.

Inheritance
Object
ConcurrentSet<T>
Namespace: NanoByte.Common.Collections
Assembly: NanoByte.Common.dll
Syntax
public class ConcurrentSet<T> : Object
Type Parameters
Name Description
T

The type of the values in the set.

Remarks

This class is thread-safe.

Constructors

ConcurrentSet()

Creates a new concurrent set.

Declaration
public ConcurrentSet()

ConcurrentSet(IEnumerable<T>)

Creates a new concurrent set.

Declaration
public ConcurrentSet(IEnumerable<T> collection)
Parameters
Type Name Description
IEnumerable<T> collection

Elements to be copied to the new set.

ConcurrentSet(IEnumerable<T>, IEqualityComparer<T>)

Creates a new concurrent set.

Declaration
public ConcurrentSet(IEnumerable<T> collection, IEqualityComparer<T> comparer)
Parameters
Type Name Description
IEnumerable<T> collection

Elements to be copied to the new set.

IEqualityComparer<T> comparer

The IEqualityComparer<T> implementation to use when comparing elements.

ConcurrentSet(IEqualityComparer<T>)

Creates a new concurrent set.

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

The IEqualityComparer<T> implementation to use when comparing elements.

ConcurrentSet(Int32, IEnumerable<T>, IEqualityComparer<T>)

Creates a new concurrent set.

Declaration
public ConcurrentSet(int concurrencyLevel, IEnumerable<T> collection, IEqualityComparer<T> comparer)
Parameters
Type Name Description
Int32 concurrencyLevel

The estimated number of threads that will update the set concurrently

IEnumerable<T> collection

Elements to be copied to the new set.

IEqualityComparer<T> comparer

The IEqualityComparer<T> implementation to use when comparing values.

ConcurrentSet(Int32, Int32)

Creates a new concurrent set.

Declaration
public ConcurrentSet(int concurrencyLevel, int capacity)
Parameters
Type Name Description
Int32 concurrencyLevel

The estimated number of threads that will update the set concurrently

Int32 capacity

The initial number of elements that the set can contain.

Properties

Count

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

IsReadOnly

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

Methods

Add(T)

Declaration
public void Add(T item)
Parameters
Type Name Description
T item

Clear()

Declaration
public void Clear()

Contains(T)

Declaration
public bool Contains(T item)
Parameters
Type Name Description
T item
Returns
Type Description
Boolean

CopyTo(T[], Int32)

Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type Name Description
T[] array
Int32 arrayIndex

GetEnumerator()

Declaration
public IEnumerator GetEnumerator()
Returns
Type Description
IEnumerator

Remove(T)

Declaration
public bool Remove(T item)
Parameters
Type Name Description
T item
Returns
Type Description
Boolean

Extension Methods

UpdateUtils.To<TIn, TOut>(TIn, Func<TIn, TOut>)
JsonStorage.SaveJson<T>(T, Stream)
JsonStorage.SaveJson<T>(T, String)
JsonStorage.ToJsonString<T>(T)
JsonStorage.ReparseAsJson<T>(Object)
JsonStorage.ReparseAsJson<T>(Object, T)
XmlStorage.SaveXml(Object, Stream, String)
XmlStorage.SaveXml<T>(T, String, String)
XmlStorage.ToXmlString(Object, String)
ConversionUtils.ConvertToString<TType>(TType)
In This Article
Back to top Copyright Bastian Eicher