Table of Contents

Class TransientMap<TK, TV>

Namespace
Map
Assembly
Map.dll

A mutable, transient version of a Map<TK, TV> that can be efficiently modified before being converted back to an immutable map.

public sealed class TransientMap<TK, TV>

Type Parameters

TK
TV
Inheritance
TransientMap<TK, TV>
Inherited Members

Methods

Add(TK, TV)

Adds an element with the provided key and value to the map. If the key already exists, the existing value is updated.

public void Add(TK key, TV value)

Parameters

key TK

The object to use as the key of the element to add.

value TV

The object to use as the value of the element to add.

Remove(TK)

Removes the element with the specified key from the map.

public void Remove(TK key)

Parameters

key TK

The key of the element to remove.

ToImmutable()

Creates an immutable Map<TK, TV> from the contents of this transient map. This operation is an O(1) operation and does not involve copying the data.

public Map<TK, TV> ToImmutable()

Returns

Map<TK, TV>

An immutable map.

TryGetValue(TK, out TV)

Attempts to get the value associated with the specified key.

public bool TryGetValue(TK key, out TV value)

Parameters

key TK

The key of the value to get.

value TV

When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.

Returns

bool

true if the key was found; otherwise, false.