Table of Contents

Class ConcurrentReadOnlyCollection<T>

Namespace
LfrlAnvil.Async
Assembly
LfrlAnvil.Core.dll

Wraps an IReadOnlyCollection<T> instance in a thread-safe object.

public sealed class ConcurrentReadOnlyCollection<T> : IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T

Collection element's type.

Inheritance
ConcurrentReadOnlyCollection<T>
Implements
Inherited Members
Extension Methods

Constructors

ConcurrentReadOnlyCollection(IReadOnlyCollection<T>, object?)

Creates a ConcurrentReadOnlyCollection<T> instance.

public ConcurrentReadOnlyCollection(IReadOnlyCollection<T> collection, object? sync = null)

Parameters

collection IReadOnlyCollection<T>

Wrapped collection.

sync object

An optional object on which the monitor lock will be acquired.

Properties

Count

Gets the number of elements in the collection.

public int Count { get; }

Property Value

int

The number of elements in the collection.

Methods

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

An enumerator that can be used to iterate through the collection.

Remarks

The enumerator will acquire and hold the monitor lock until it gets disposed.