DotNext by .NET Foundation and Contributors

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

 TypeMap<TValue>

public class TypeMap<TValue> : ITypeMap<TValue>, IReadOnlyTypeMap<TValue>
Represents fast implementation of ITypeMap<T> that is not thread safe.
public struct Enumerator<TValue>

Gets the enumerator over the values.

public TypeMap(int capacity)

Initializes a new map.

public TypeMap()

Initializes a new map of recommended capacity.

public void Add<TKey>(TValue value)

Associates a new value with the type.

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 ref TValue GetValueRefOrAddDefault<TKey>(out bool exists)

Gets the value associated with the specified type.

public bool Remove<TKey>()

Attempts to remove the value from the map.

public bool Remove<TKey>(out TValue value)

Attempts to remove the value from the map.

public Optional<TValue> Replace<TKey>(TValue newValue)

Replaces the existing value with a new value.

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 TryGetValue<TKey>(out TValue value)

Attempts to get the value associated with the specified type.