DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="5.8.0" />

 ConcurrentTypeMap<TValue>

public class ConcurrentTypeMap<TValue> : ITypeMap<TValue>, IReadOnlyTypeMap<TValue>
Represents thread-safe implementation of ITypeMap<T> interface.
public struct Enumerator<TValue>

Represents an enumerator over the values in the map.

public ConcurrentTypeMap(int capacity)

Initializes a new map.

Initializes a new map of recommended capacity.

public bool AddOrUpdate<TKey>(TValue value)

Adds a value to the map if the key does not already exist, or updates the existing value.

public void Clear()

Removes all elements from this map.

public bool ContainsKey<TKey>()

Determines whether the map has association between the value and the specified type.

public Enumerator<TValue> GetEnumerator()

Gets enumerator over the values.

public TValue GetOrAdd<TKey>(TValue value, out bool added)

Adds a value to the map if the key does not already exist. Returns the new value, or the existing value if the key already exists.

public bool Remove<TKey>(out TValue value)

Attempts to remove the value from the map.

public bool Remove<TKey>()

Attempts to remove the value from the map.

public void Set<TKey>(TValue value)

Associates the value with the specified type.

public bool Set<TKey>(TValue newValue, out TValue oldValue)

Replaces the existing value with a new value.

public bool TryAdd<TKey>(TValue value)

Attempts to associate a value with the type.

public bool TryGetValue<TKey>(out TValue value)

Attempts to get the value associated with the specified type.