Search Results for

    Show / Hide Table of Contents

    Struct IntKeyDictionary<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 IntKeyDictionary<TValue>
    Type Parameters
    Name Description
    TValue

    Constructors

    | Improve this Doc View Source

    IntKeyDictionary(Int32)

    Initializes the dictionary with at least minCapacity capacity.

    Declaration
    public IntKeyDictionary(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 IntKeyEntry<TValue>[] Entries
    Field Value
    Type Description
    IntKeyEntry<TValue>[]
    | Improve this Doc View Source

    FreeListHead

    Declaration
    public int FreeListHead
    Field Value
    Type Description
    System.Int32

    Properties

    | Improve this Doc View Source

    Item[Int32]

    Directly access a value by key.

    Declaration
    public TValue this[int key] { get; set; }
    Parameters
    Type Name Description
    System.Int32 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(Int32, TValue)

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

    Declaration
    public bool AddSafe(int key, TValue value)
    Parameters
    Type Name Description
    System.Int32 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(Int32, TValue)

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

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

    The key to add.

    TValue value

    The value to add.

    | Improve this Doc View Source

    AddWithExpandCheck(Int32, TValue)

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

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

    The key to add.

    TValue value

    The value to add.

    | Improve this Doc View Source

    AddWithUniqueCheck(Int32, TValue)

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

    Declaration
    public bool AddWithUniqueCheck(int key, TValue value)
    Parameters
    Type Name Description
    System.Int32 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(Int32)

    Checks if the dictionary contains the given key.

    Declaration
    public bool ContainsKey(int key)
    Parameters
    Type Name Description
    System.Int32 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(Int32)

    Finds the index of the entry corresponding to a key.

    Declaration
    public int IndexOf(int key)
    Parameters
    Type Name Description
    System.Int32 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.

    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

    Remarks

    If you use iteratedIndexCount during iteration, you need to decrement it by 1 to properly access the current iterations index.

    If you suspect the dictionary might be modified while iterating, this will not catch the error. You must use the other overload instead.

    | Improve this Doc View Source

    MoveNext(ref Int32, out IntKeyEntry<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 IntKeyEntry<TValue> entry)
    Parameters
    Type Name Description
    System.Int32 iteratedIndexCount

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

    IntKeyEntry<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 IntKeyEntry<TValue>)

    Iterates the dictionary.

    Declaration
    public IteratorState MoveNext(ref int iteratedIndexCount, int iteratorVersion, in int dictionaryVersion, out IntKeyEntry<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.

    IntKeyEntry<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(Int32, out TValue)

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

    Declaration
    public bool TryGetValue(int key, out TValue value)
    Parameters
    Type Name Description
    System.Int32 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(Int32, TValue)

    Replaces the value of the entry if the entry exists.

    Declaration
    public bool TryModifyValue(int key, TValue value)
    Parameters
    Type Name Description
    System.Int32 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(Int32)

    Removes the entry if it exists.

    Declaration
    public bool TryRemove(int key)
    Parameters
    Type Name Description
    System.Int32 key

    The key to remove.

    Returns
    Type Description
    System.Boolean

    True if the entry was found.

    | Improve this Doc View Source

    TryRemoveNoValueClear(Int32)

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

    Declaration
    public bool TryRemoveNoValueClear(int key)
    Parameters
    Type Name Description
    System.Int32 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.