Show / Hide Table of Contents

Class ConcurrentTypeMap

Represents thread-safe implementation of ITypeMap interface.

Inheritance
object
ConcurrentTypeMap
Implements
ITypeMap
IReadOnlyTypeMap
IEnumerable<object>
IEnumerable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Collections.Specialized
Assembly: DotNext.dll
Syntax
public class ConcurrentTypeMap : ITypeMap, IReadOnlyTypeMap, IEnumerable<object>, IEnumerable

Constructors

| Edit this page View Source

ConcurrentTypeMap()

Initializes a new empty set.

Declaration
public ConcurrentTypeMap()
| Edit this page View Source

ConcurrentTypeMap(int)

Initializes a new empty set.

Declaration
public ConcurrentTypeMap(int capacity)
Parameters
Type Name Description
int capacity

The initial capacity of the map.

Exceptions
Type Condition
ArgumentOutOfRangeException

capacity is less than zero.

Methods

| Edit this page View Source

AddOrUpdate<T>(T)

Adds a new value or updates existing one, atomically.

Declaration
public bool AddOrUpdate<T>(T value)
Parameters
Type Name Description
T value

The value to be set.

Returns
Type Description
bool

true if value is added; false if the existing value is updated with value.

Type Parameters
Name Description
T

The type of the value.

| Edit this page View Source

Clear()

Removes all elements from this set.

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

Contains<T>()

Determines whether the set has the value of type T.

Declaration
public bool Contains<T>()
Returns
Type Description
bool

true if this set has a value of type T; otherwise, false.

Type Parameters
Name Description
T

The type of the value.

| Edit this page View Source

GetEnumerator()

Gets an enumerator over values in this map.

Declaration
public ConcurrentTypeMap.Enumerator GetEnumerator()
Returns
Type Description
ConcurrentTypeMap.Enumerator

The enumerator over values in this map.

| Edit this page View Source

GetOrAdd<T>(T, out bool)

Attempts to add a new value or returns existing value, atomitcally.

Declaration
public T GetOrAdd<T>(T value, out bool added)
Parameters
Type Name Description
T value

The value to be added.

bool added

true if the value is added; false if the value is already exist.

Returns
Type Description
T

The existing value; or value if added.

Type Parameters
Name Description
T

The type of the value.

| Edit this page View Source

Remove<T>()

Attempts to remove the value of type T from this set.

Declaration
public bool Remove<T>()
Returns
Type Description
bool

true if the element successfully removed; otherwise, false.

Type Parameters
Name Description
T

The type which value should be removed.

| Edit this page View Source

Remove<T>(out T?)

Attempts to remove the value of type T from this set.

Declaration
public bool Remove<T>(out T? value)
Parameters
Type Name Description
T value

Removed value.

Returns
Type Description
bool

true if the element successfully removed; otherwise, false.

Type Parameters
Name Description
T

The type which value should be removed.

| Edit this page View Source

Set<T>(T)

Adds or overwrites the value associated with type T.

Declaration
public void Set<T>(T value)
Parameters
Type Name Description
T value

The value to set.

Type Parameters
Name Description
T

The type of the value.

| Edit this page View Source

Set<T>(T, out T?)

Replaces the value associated with type T.

Declaration
public bool Set<T>(T newValue, out T? oldValue)
Parameters
Type Name Description
T newValue

The value to set.

T oldValue

The replaced value.

Returns
Type Description
bool

true if value is replaced; false if a new value is added without replacement.

Type Parameters
Name Description
T

The type of the value.

| Edit this page View Source

TryAdd<T>(T)

Attempts to add a new value to this set.

Declaration
public bool TryAdd<T>(T value)
Parameters
Type Name Description
T value

The value to be added.

Returns
Type Description
bool

true if the value is added; otherwise, false.

Type Parameters
Name Description
T

The type of the value.

| Edit this page View Source

TryGetValue<T>(out T?)

Attempts to get the value of the specified type.

Declaration
public bool TryGetValue<T>(out T? value)
Parameters
Type Name Description
T value

The value stored in the set.

Returns
Type Description
bool

true if the value of type T exists in this set; otherwise, false.

Type Parameters
Name Description
T

The type of the value.

Implements

ITypeMap
IReadOnlyTypeMap
IEnumerable<T>
IEnumerable

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
Collection.Append<T>(IEnumerable<T>, params T[])
Collection.Copy<T>(IEnumerable<T>, int, MemoryAllocator<T>?)
Collection.ElementAt<T>(IEnumerable<T>, int, out T)
Collection.FirstOrNone<T>(IEnumerable<T>)
Collection.ForEachAsync<T>(IEnumerable<T>, Func<T, CancellationToken, ValueTask>, CancellationToken)
Collection.ForEach<T>(IEnumerable<T>, Action<T>)
Collection.LastOrNone<T>(IEnumerable<T>)
Collection.Prepend<T>(IEnumerable<T>, params T[])
Collection.SequenceHashCode<T>(IEnumerable<T>, bool)
Collection.SkipNulls<T>(IEnumerable<T?>)
Collection.ToAsyncEnumerable<T>(IEnumerable<T>)
Collection.ToString<T>(IEnumerable<T>, string, string)
Enumerator.GetAsyncEnumerator<T>(IEnumerable<T>, CancellationToken)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾