FSharp.Core by F# Software Foundation

<PackageReference Include="FSharp.Core" Version="4.0.0.1" />

 FSharpMap<TKey, TValue>

public sealed class FSharpMap<TKey, TValue> : IComparable, ICollection<KeyValuePair<TKey, TValue>>, IDictionary<TKey, TValue>, IEnumerable, IEnumerable<KeyValuePair<TKey, TValue>>
Immutable maps. Keys are ordered by F# generic comparison.
public int Count { get; }

The number of bindings in the map.

public bool IsEmpty { get; }

Returns true if there are no bindings in the map.

public TValue this[TKey key] { get; }

Lookup an element in the map. Raise KeyNotFoundException if no binding exists in the map.

public FSharpMap(IEnumerable<Tuple<TKey, TValue>> elements)

Builds a map that contains the bindings of the given IEnumerable.

public FSharpMap<TKey, TValue> Add(TKey key, TValue value)

Returns a new map with the binding added to the given map.

public bool ContainsKey(TKey key)

Tests if an element is in the domain of the map.

public FSharpMap<TKey, TValue> Remove(TKey key)

Removes an element from the domain of the map. No exception is raised if the element is not present.

public FSharpOption<TValue> TryFind(TKey key)

Lookup an element in the map, returning a Some value if the element is in the domain of the map and None if not.