Search Results for

    Show / Hide Table of Contents

    Struct ImmutableOrderedDictionary<TKey, TValue>

    An immutable dictionary that iterates over elements in the order they were added.

    Implements
    IImmutableDictionary<TKey, TValue>
    IReadOnlyDictionary<TKey, TValue>
    IReadOnlyCollection<KeyValuePair<TKey, TValue>>
    IEnumerable<KeyValuePair<TKey, TValue>>
    IEnumerable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Flame.Collections
    Assembly: Flame.Compiler.dll
    Syntax
    public struct ImmutableOrderedDictionary<TKey, TValue> : IImmutableDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
    Type Parameters
    Name Description
    TKey
    TValue

    Fields

    | Edit this page View Source

    Empty

    An empty immutable ordered dictionary.

    Declaration
    public static readonly ImmutableOrderedDictionary<TKey, TValue> Empty
    Field Value
    Type Description
    ImmutableOrderedDictionary<TKey, TValue>

    Properties

    | Edit this page View Source

    Count

    Gets the number of elements in this dictionary.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    this[TKey]

    Gets the value for a particular key.

    Declaration
    public TValue this[TKey key] { get; }
    Parameters
    Type Name Description
    TKey key

    The key to look up.

    Property Value
    Type Description
    TValue
    | Edit this page View Source

    Keys

    Gets a sequence of all keys in this dictionary.

    Declaration
    public IEnumerable<TKey> Keys { get; }
    Property Value
    Type Description
    IEnumerable<TKey>
    | Edit this page View Source

    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 Source

    Add(TKey, TValue)

    Adds a key-value pair to this ordered dictionary.

    Declaration
    public ImmutableOrderedDictionary<TKey, TValue> Add(TKey key, TValue value)
    Parameters
    Type Name Description
    TKey key

    The key to add to the dictionary.

    TValue value

    The value to associate with key.

    Returns
    Type Description
    ImmutableOrderedDictionary<TKey, TValue>

    A new dictionary that includes the key-value pair.

    | Edit this page View Source

    AddRange(IEnumerable<KeyValuePair<TKey, TValue>>)

    Adds a sequence of key-value pairs to this ordered dictionary.

    Declaration
    public ImmutableOrderedDictionary<TKey, TValue> AddRange(IEnumerable<KeyValuePair<TKey, TValue>> pairs)
    Parameters
    Type Name Description
    IEnumerable<KeyValuePair<TKey, TValue>> pairs

    The key-value pairs to add to the dictionary.

    Returns
    Type Description
    ImmutableOrderedDictionary<TKey, TValue>

    A new dictionary that includes the key-value pairs.

    | Edit this page View Source

    Clear()

    Creates an immutable ordered dictionary that does not contain any elements.

    Declaration
    public ImmutableOrderedDictionary<TKey, TValue> Clear()
    Returns
    Type Description
    ImmutableOrderedDictionary<TKey, TValue>

    A new immutable ordered dictionary.

    | Edit this page View Source

    Contains(KeyValuePair<TKey, TValue>)

    Tests if this dictionary contains a particular key-value pair.

    Declaration
    public bool Contains(KeyValuePair<TKey, TValue> pair)
    Parameters
    Type Name Description
    KeyValuePair<TKey, TValue> pair

    The key-value pair to look for.

    Returns
    Type Description
    bool

    true if this dictionary contains the key-value pair; otherwise, false.

    | Edit this page View Source

    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

    true if this dictionary contains the key; otherwise, false.

    | Edit this page View Source

    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.

    | Edit this page View Source

    Remove(TKey)

    Removes a key-value pair from this immutable ordered dictionary.

    Declaration
    public ImmutableOrderedDictionary<TKey, TValue> Remove(TKey key)
    Parameters
    Type Name Description
    TKey key

    The key of the key-value pair to remove.

    Returns
    Type Description
    ImmutableOrderedDictionary<TKey, TValue>

    An immutable ordered dictionary that does not contain the key.

    | Edit this page View Source

    RemoveRange(IEnumerable<TKey>)

    Removes a sequence of key-value pairs from this immutable ordered dictionary.

    Declaration
    public ImmutableOrderedDictionary<TKey, TValue> RemoveRange(IEnumerable<TKey> keys)
    Parameters
    Type Name Description
    IEnumerable<TKey> keys

    The keys of the key-value pairs to remove.

    Returns
    Type Description
    ImmutableOrderedDictionary<TKey, TValue>

    An immutable ordered dictionary that does not contain keys.

    | Edit this page View Source

    SetItem(TKey, TValue)

    Assigns a value to a particular key.

    Declaration
    public ImmutableOrderedDictionary<TKey, TValue> SetItem(TKey key, TValue value)
    Parameters
    Type Name Description
    TKey key

    The key to assign a value to.

    TValue value

    The value to assign to the key.

    Returns
    Type Description
    ImmutableOrderedDictionary<TKey, TValue>

    An immutable ordered dictionary that associates key with value.

    | Edit this page View Source

    SetItems(IEnumerable<KeyValuePair<TKey, TValue>>)

    Assigns values to keys.

    Declaration
    public ImmutableOrderedDictionary<TKey, TValue> SetItems(IEnumerable<KeyValuePair<TKey, TValue>> items)
    Parameters
    Type Name Description
    IEnumerable<KeyValuePair<TKey, TValue>> items

    The key-value pairs to add or update.

    Returns
    Type Description
    ImmutableOrderedDictionary<TKey, TValue>

    An immutable ordered dictionary that contains items as key-value pairs.

    | Edit this page View Source

    ToBuilder()

    Creates a mutable version of this immutable ordered dictionary.

    Declaration
    public ImmutableOrderedDictionary<TKey, TValue>.Builder ToBuilder()
    Returns
    Type Description
    ImmutableOrderedDictionary<TKey, TValue>.Builder

    An ordered dictionary builder.

    | Edit this page View Source

    TryGetKey(TKey, out TKey)

    Determines whether this dictionary contains a specified key.

    Declaration
    public bool TryGetKey(TKey equalKey, out TKey actualKey)
    Parameters
    Type Name Description
    TKey equalKey

    The key to search for.

    TKey actualKey

    The matching key located in the dictionary if found, or equalkey if no match is found.

    Returns
    Type Description
    bool

    true if a match for equalKey is found; otherwise, false.

    | Edit this page View Source

    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 value parameter. This parameter is passed uninitialized.

    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

    key is null.

    Implements

    IImmutableDictionary<TKey, TValue>
    IReadOnlyDictionary<TKey, TValue>
    IReadOnlyCollection<T>
    IEnumerable<T>
    IEnumerable

    Extension Methods

    BetternessExtensions.GetBestElementOrDefault<T>(IEnumerable<T>, Func<T, T, Betterness>)
    BetternessExtensions.TryGetBestElement<T>(IEnumerable<T>, Func<T, T, Betterness>, out T)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX