Class ImmutableOrderedDictionary<TKey, TValue>.Builder
A mutable wrapper around an immutable ordered dictionary.
Inheritance
Implements
Inherited Members
Namespace: Flame.Collections
Assembly: Flame.Compiler.dll
Syntax
public sealed class Builder : IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Properties
| Improve this Doc View SourceCount
Gets the number of key-value pairs in this dictionary.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[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 |
---|---|
System.Collections.Generic.IEqualityComparer<TKey> |
Keys
Gets a sequence of all keys in this dictionary.
Declaration
public IEnumerable<TKey> Keys { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TKey> |
ValueComparer
Gets the value comparer for this dictionary.
Declaration
public IEqualityComparer<TValue> ValueComparer { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEqualityComparer<TValue> |
Values
Gets a sequence of all values in this dictionary.
Declaration
public IEnumerable<TValue> Values { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TValue> |
Methods
| Improve this Doc View SourceAdd(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 |
Add(KeyValuePair<TKey, TValue>)
Adds a key-value pair to this dictionary.
Declaration
public void Add(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item | The key-value pair to add. |
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 |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.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 |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item | The key-value pair to look for. |
Returns
Type | Description |
---|---|
System.Boolean |
|
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 |
---|---|
System.Boolean |
|
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 |
---|---|
System.Boolean |
|
GetEnumerator()
Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> |
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(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 |
---|---|
System.Boolean |
|
Remove(KeyValuePair<TKey, TValue>)
Removes a key-value pair from this dictionary.
Declaration
public bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item | The key-value pair to remove. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RemoveRange(IEnumerable<TKey>)
Removes a range of keys from this ordered dictionary.
Declaration
public void RemoveRange(IEnumerable<TKey> keys)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.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 |
---|---|
System.Boolean |
|
TryGetValue(TKey, out TValue)
Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | |
TValue | value |
Returns
Type | Description |
---|---|
System.Boolean |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |