Class ImmutableOrderedDictionary<TKey, TValue>.Builder
A mutable wrapper around an immutable ordered dictionary.
Implements
Inherited Members
Namespace: Flame.Collections
Assembly: Flame.Compiler.dll
Syntax
public sealed class ImmutableOrderedDictionary<TKey, TValue>.Builder : IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Properties
| Edit this page View SourceCount
Gets the number of key-value pairs in this dictionary.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
this[TKey]
Gets or sets the value associated with a particular key.
Declaration
public TValue this[TKey key] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to access. |
Property Value
| Type | Description |
|---|---|
| TValue | The value associated with |
KeyComparer
Gets the value comparer for this dictionary.
Declaration
public IEqualityComparer<TKey> KeyComparer { get; }
Property Value
| Type | Description |
|---|---|
| IEqualityComparer<TKey> |
Keys
Gets a sequence of all keys in this dictionary.
Declaration
public IEnumerable<TKey> Keys { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<TKey> |
ValueComparer
Gets the value comparer for this dictionary.
Declaration
public IEqualityComparer<TValue> ValueComparer { get; }
Property Value
| Type | Description |
|---|---|
| IEqualityComparer<TValue> |
Values
Gets a sequence of all values in this dictionary.
Declaration
public IEnumerable<TValue> Values { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<TValue> |
Methods
| Edit this page View SourceAdd(KeyValuePair<TKey, TValue>)
Adds a key-value pair to this dictionary.
Declaration
public void Add(KeyValuePair<TKey, TValue> item)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyValuePair<TKey, TValue> | item | The key-value pair to add. |
Add(TKey, TValue)
Adds a key-value pair to this dictionary.
Declaration
public void Add(TKey key, TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to add. |
| TValue | value | The value to associate with |
AddRange(IEnumerable<KeyValuePair<TKey, TValue>>)
Adds a sequence of key-value pairs to this dictionary.
Declaration
public void AddRange(IEnumerable<KeyValuePair<TKey, TValue>> items)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<KeyValuePair<TKey, TValue>> | items | The key-value pairs to add. |
Clear()
Removes all key-value pairs from this dictionary.
Declaration
public void Clear()
Contains(KeyValuePair<TKey, TValue>)
Tests if this dictionary contains a key-value pair.
Declaration
public bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyValuePair<TKey, TValue> | item | The key-value pair to look for. |
Returns
| Type | Description |
|---|---|
| bool |
|
ContainsKey(TKey)
Tests if this dictionary contains a particular key.
Declaration
public bool ContainsKey(TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to look for. |
Returns
| Type | Description |
|---|---|
| bool |
|
ContainsValue(TValue)
Tests if this dictionary contains a particular value.
Declaration
public bool ContainsValue(TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| TValue | value | The value to look for. |
Returns
| Type | Description |
|---|---|
| bool |
|
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<KeyValuePair<TKey, TValue>> | An enumerator that can be used to iterate through the collection. |
GetValueOrDefault(TKey)
Gets the value associated with a particular key or a default value if this dictionary does not contain the key.
Declaration
public TValue GetValueOrDefault(TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to look for. |
Returns
| Type | Description |
|---|---|
| TValue | The value associated with |
GetValueOrDefault(TKey, TValue)
Gets the value associated with a particular key or a default value if this dictionary does not contain the key.
Declaration
public TValue GetValueOrDefault(TKey key, TValue defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to look for. |
| TValue | defaultValue | The value to return if this dictionary does not contain
|
Returns
| Type | Description |
|---|---|
| TValue | The value associated with |
Remove(KeyValuePair<TKey, TValue>)
Removes a key-value pair from this dictionary.
Declaration
public bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyValuePair<TKey, TValue> | item | The key-value pair to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remove(TKey)
Removes a key from this dictionary.
Declaration
public bool Remove(TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|
RemoveRange(IEnumerable<TKey>)
Removes a range of keys from this ordered dictionary.
Declaration
public void RemoveRange(IEnumerable<TKey> keys)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<TKey> | keys | The keys to remove. |
ToImmutable()
Creates an immutable ordered dictionary from this mutable builder.
Declaration
public ImmutableOrderedDictionary<TKey, TValue> ToImmutable()
Returns
| Type | Description |
|---|---|
| ImmutableOrderedDictionary<TKey, TValue> | An immutable ordered dictionary. |
TryGetKey(TKey, out TKey)
Tries to find a key in this dictionary.
Declaration
public bool TryGetKey(TKey equalKey, out TKey actualKey)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | equalKey | A key that is equal to the key to look for. |
| TKey | actualKey | The key that is stored in the dictionary. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetValue(TKey, out TValue)
Gets the value that is associated with the specified key.
Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to locate. |
| TValue | value | When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the |
Returns
| Type | Description |
|---|---|
| bool | true if the object that implements the IReadOnlyDictionary<TKey, TValue> interface contains an element that has the specified key; otherwise, false. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|