Search Results for

    Show / Hide Table of Contents

    Class ConcurrentSet<T>

    A thread-safe set implementation using a ConcurrentDictionary<TKey, TValue>.

    Inheritance
    object
    ConcurrentSet<T>
    Implements
    ICollection<T>
    IEnumerable<T>
    IEnumerable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Util
    Assembly: Akka.dll
    Syntax
    public class ConcurrentSet<T> : ICollection<T>, IEnumerable<T>, IEnumerable
    Type Parameters
    Name Description
    T

    The type of elements in the set.

    Constructors

    | Edit this page View Source

    ConcurrentSet()

    Initializes a new, empty instance of the ConcurrentSet<T> class.

    Declaration
    public ConcurrentSet()
    | Edit this page View Source

    ConcurrentSet(IEnumerable<T>)

    Initializes a new instance of the ConcurrentSet<T> class that contains elements copied from the specified collection.

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

    The collection whose elements are copied to the new set.

    | Edit this page View Source

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

    Initializes a new instance of the ConcurrentSet<T> class that contains elements copied from the specified collection and uses the specified equality comparer.

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

    The collection whose elements are copied to the new set.

    IEqualityComparer<T> comparer

    The equality comparer to use for the set.

    | Edit this page View Source

    ConcurrentSet(IEqualityComparer<T>)

    Initializes a new, empty instance of the ConcurrentSet<T> class that uses the specified equality comparer.

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

    The equality comparer to use for the set.

    | Edit this page View Source

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

    Initializes a new instance of the ConcurrentSet<T> class that contains elements copied from the specified collection, has the specified concurrency level, and uses the specified equality comparer.

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

    The estimated number of threads that will update the set concurrently.

    IEnumerable<T> collection

    The collection whose elements are copied to the new set.

    IEqualityComparer<T> comparer

    The equality comparer to use for the set.

    | Edit this page View Source

    ConcurrentSet(int, int)

    Initializes a new, empty instance of the ConcurrentSet<T> class with the specified concurrency level and capacity.

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

    The estimated number of threads that will update the set concurrently.

    int capacity

    The initial number of elements that the set can contain.

    | Edit this page View Source

    ConcurrentSet(int, int, IEqualityComparer<T>)

    Initializes a new, empty instance of the ConcurrentSet<T> class with the specified concurrency level, capacity, and equality comparer.

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

    The estimated number of threads that will update the set concurrently.

    int capacity

    The initial number of elements that the set can contain.

    IEqualityComparer<T> comparer

    The equality comparer to use for the set.

    Properties

    | Edit this page View Source

    Count

    Gets the number of elements contained in the set.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    IsEmpty

    Gets a value indicating whether the set is empty.

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

    Methods

    | Edit this page View Source

    Clear()

    Removes all elements from the set.

    Declaration
    public void Clear()
    | Edit this page View Source

    Contains(T)

    Determines whether the set contains a specific value.

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

    The object to locate in the set.

    Returns
    Type Description
    bool

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

    | Edit this page View Source

    TryAdd(T)

    Attempts to add the specified element to the set.

    Declaration
    public bool TryAdd(T item)
    Parameters
    Type Name Description
    T item

    The element to add to the set.

    Returns
    Type Description
    bool

    true if the element is added to the set; false if the element is already present.

    | Edit this page View Source

    TryRemove(T)

    Attempts to remove and return the specified element from the set.

    Declaration
    public bool TryRemove(T item)
    Parameters
    Type Name Description
    T item

    The element to remove.

    Returns
    Type Description
    bool

    true if the element is successfully removed; otherwise, false.

    Implements

    ICollection<T>
    IEnumerable<T>
    IEnumerable

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    EnumerableExtensions.Grouped<T>(IEnumerable<T>, int)
    Extensions.Concat<T>(IEnumerable<T>?, T)
    Extensions.Drop<T>(IEnumerable<T>, int)
    Extensions.ForEach<T>(IEnumerable<T>, Action<T>)
    Extensions.Head<T>(IEnumerable<T>)
    Extensions.TakeRight<T>(IEnumerable<T>, int)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET