Search Results for

    Show / Hide Table of Contents

    Struct StringKeyDictionary<TValue>

    An optimized System.Collections.Generic.Dictionary<TKey, TValue>-like data structure with a System.String key requirement.

    Namespace: GDX.Collections.Generic
    Syntax
    [Serializable]
    public struct StringKeyDictionary<TValue>
    Type Parameters
    Name Description
    TValue

    Constructors

    | Improve this Doc View Source

    StringKeyDictionary(Int32)

    Initializes the dictionary with at least minCapacity capacity.

    Declaration
    public StringKeyDictionary(int minCapacity)
    Parameters
    Type Name Description
    System.Int32 minCapacity

    The minimal initial capacity to reserve.

    Fields

    | Improve this Doc View Source

    Buckets

    Declaration
    public int[] Buckets
    Field Value
    Type Description
    System.Int32[]
    | Improve this Doc View Source

    Count

    Declaration
    public int Count
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Entries

    Declaration
    public StringKeyEntry<TValue>[] Entries
    Field Value
    Type Description
    StringKeyEntry<TValue>[]
    | Improve this Doc View Source

    FreeListHead

    Declaration
    public int FreeListHead
    Field Value
    Type Description
    System.Int32

    Properties

    | Improve this Doc View Source

    Item[String]

    Directly access a value by key.

    Declaration
    public TValue this[string key] { get; set; }
    Parameters
    Type Name Description
    System.String key

    The target key to look for a value identified by.

    Property Value
    Type Description
    TValue
    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when a null key is provided to lookup.

    System.Collections.Generic.KeyNotFoundException

    Thrown when the key is not found in the StringKeyDictionary<TValue>.

    Methods

    | Improve this Doc View Source

    AddSafe(String, TValue)

    Adds the key value pair to the dictionary, checking for duplicate entries and expanding if necessary.

    Declaration
    public bool AddSafe(string key, TValue value)
    Parameters
    Type Name Description
    System.String key

    The key to add.

    TValue value

    The value to add.

    Returns
    Type Description
    System.Boolean

    True if the entry was successfully created.

    | Improve this Doc View Source

    AddUnchecked(String, TValue)

    Adds the key value pair to the dictionary, without checking for available capacity or duplicate entries.

    Declaration
    public void AddUnchecked(string key, TValue value)
    Parameters
    Type Name Description
    System.String key

    The key to add.

    TValue value

    The value to add.

    | Improve this Doc View Source

    AddWithExpandCheck(String, TValue)

    Adds the key value pair to the dictionary, expanding if necessary but not checking for duplicate entries.

    Declaration
    public void AddWithExpandCheck(string key, TValue value)
    Parameters
    Type Name Description
    System.String key

    The key to add.

    TValue value

    The value to add.

    | Improve this Doc View Source

    AddWithUniqueCheck(String, TValue)

    Adds the key value pair to the dictionary, checking for duplicates but not expanding if necessary.

    Declaration
    public bool AddWithUniqueCheck(string key, TValue value)
    Parameters
    Type Name Description
    System.String key

    The key to add.

    TValue value

    The value to add.

    Returns
    Type Description
    System.Boolean

    True if the entry was successfully created.

    | Improve this Doc View Source

    Clear()

    Clears the dictionary.

    Declaration
    public void Clear()
    | Improve this Doc View Source

    ContainsKey(String)

    Checks if the dictionary contains the given key.

    Declaration
    public bool ContainsKey(string key)
    Parameters
    Type Name Description
    System.String key

    The key to check for.

    Returns
    Type Description
    System.Boolean

    True if the dictionary contains the key.

    | Improve this Doc View Source

    ExpandWhenFull()

    Resizes the dictionary with the assumption that it is full. Do not use otherwise.

    Declaration
    public void ExpandWhenFull()
    | Improve this Doc View Source

    IndexOf(String)

    Finds the index of the entry corresponding to a key.

    Declaration
    public int IndexOf(string key)
    Parameters
    Type Name Description
    System.String key

    The key to find the index of.

    Returns
    Type Description
    System.Int32

    The index of the entry, or -1 if the entry does not exist.

    | Improve this Doc View Source

    MoveNext(ref Int32)

    Iterates the dictionary. NOTE: if you suspect the dictionary might be modified while iterating, this will not catch the error -- use the other overload instead.

    Declaration
    public bool MoveNext(ref int iteratedIndexCount)
    Parameters
    Type Name Description
    System.Int32 iteratedIndexCount

    The number of indices iterated so far - pass in 0 at the start of iteration.

    Returns
    Type Description
    System.Boolean

    Whether or not the iterator found an entry

    | Improve this Doc View Source

    MoveNext(ref Int32, out StringKeyEntry<TValue>)

    Iterates the dictionary. NOTE: if you suspect the dictionary might be modified while iterating, this will not catch the error -- use the other overload instead.

    Declaration
    public bool MoveNext(ref int iteratedIndexCount, out StringKeyEntry<TValue> entry)
    Parameters
    Type Name Description
    System.Int32 iteratedIndexCount

    The number of indices iterated so far - pass in 0 at the start of iteration.

    StringKeyEntry<TValue> entry

    The entry returned by the iterator

    Returns
    Type Description
    System.Boolean

    Whether or not the iterator found an entry

    | Improve this Doc View Source

    MoveNext(ref Int32, Int32, in Int32, out StringKeyEntry<TValue>)

    Iterates the dictionary.

    Declaration
    public IteratorState MoveNext(ref int iteratedIndexCount, int iteratorVersion, in int dictionaryVersion, out StringKeyEntry<TValue> entry)
    Parameters
    Type Name Description
    System.Int32 iteratedIndexCount

    The number of indices iterated so far - pass in 0 at the start of iteration.

    System.Int32 iteratorVersion

    The version when iteration started.

    System.Int32 dictionaryVersion

    The current version of the dictionary - update this on add, remove, or clear operations.

    StringKeyEntry<TValue> entry

    The entry returned by the iterator

    Returns
    Type Description
    IteratorState

    Whether the iterator found an entry, finished iteration, or could not continue due to an invalid version.

    | Improve this Doc View Source

    Reserve(Int32)

    Expands the dictionary if it does not have enough empty space for capacityToReserve.

    Declaration
    public void Reserve(int capacityToReserve)
    Parameters
    Type Name Description
    System.Int32 capacityToReserve
    | Improve this Doc View Source

    TryGetValue(String, out TValue)

    Attempts to get the value for the given key; returns true if key was found, false otherwise.

    Declaration
    public bool TryGetValue(string key, out TValue value)
    Parameters
    Type Name Description
    System.String key

    The key to retrieve.

    TValue value

    The value of the entry found.

    Returns
    Type Description
    System.Boolean

    True if the entry was found; false otherwise.

    | Improve this Doc View Source

    TryModifyValue(String, TValue)

    Replaces the value of the entry if the entry exists.

    Declaration
    public bool TryModifyValue(string key, TValue value)
    Parameters
    Type Name Description
    System.String key

    The key of the entry to modify.

    TValue value

    The new value of the entry.

    Returns
    Type Description
    System.Boolean

    True if the entry was found.

    | Improve this Doc View Source

    TryRemove(String)

    Removes the entry if it exists.

    Declaration
    public bool TryRemove(string key)
    Parameters
    Type Name Description
    System.String key

    The key to remove.

    Returns
    Type Description
    System.Boolean

    True if the entry was found.

    | Improve this Doc View Source

    TryRemoveNoValueClear(String)

    Removes the entry if it exists, but does not remove the value of the key value pair.

    Declaration
    public bool TryRemoveNoValueClear(string key)
    Parameters
    Type Name Description
    System.String key

    The key to remove.

    Returns
    Type Description
    System.Boolean

    True if the entry was found.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Built on 2024-01-01 against 1f69a68.
    Generated by Dox+DocFX.