Search Results for

    Show / Hide Table of Contents

    Class HashDictionaryInt<TKey, TValue>

    A dictionary which uses hashes generated from the key to store items in a backing dictionary. We may look at generating long hashes eventually if there are many collisions detected.

    Inheritance
    System.Object
    HashDictionaryInt<TKey, TValue>
    Namespace: Sdl.Core.Bcm.BcmModel.Collections
    Assembly: Sdl.Core.Bcm.BcmModel.dll
    Syntax
    public class HashDictionaryInt<TKey, TValue> : Object
    Type Parameters
    Name Description
    TKey

    Item from which key will be derived. At the moment, GetHashCode is called on the key to use as actual key in backing Dictionary

    TValue

    value for given key being stored in dictionary

    Constructors

    HashDictionaryInt()

    Initializes a new instance of the HashDictionaryInt<TKey, TValue> class.

    Declaration
    public HashDictionaryInt()

    Fields

    _backingDictionary

    The backing dictionary.

    Declaration
    public Dictionary<int, List<KeyValuePair<TKey, TValue>>> _backingDictionary
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<System.Int32, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<TKey, TValue>>>

    Properties

    Item[TKey]

    Gets the TKey with the specified key.

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

    The key.

    Property Value
    Type Description
    TValue

    The TValue.

    Exceptions
    Type Condition
    System.InvalidOperationException

    Multiple matches found in collection or Key not found in collection

    Methods

    Add(TKey, TValue)

    Adds the specified key.

    Declaration
    public void Add(TKey key, TValue value)
    Parameters
    Type Name Description
    TKey key

    The key.

    TValue value

    The value.

    Exceptions
    Type Condition
    System.InvalidOperationException

    Item with same key already exists in collection

    Clear()

    Removes all keys and values from this instance.

    Declaration
    public void Clear()

    ContainsKey(TKey)

    Determines whether the collection contains the specified key.

    Declaration
    public bool ContainsKey(TKey key)
    Parameters
    Type Name Description
    TKey key

    The key.

    Returns
    Type Description
    System.Boolean

    true if the collection contains the specified key; otherwise, false.

    Exceptions
    Type Condition
    System.InvalidOperationException

    Multiple matches found in collection

    GetHashCodeInternal(TKey)

    Gets the internal hash code used in the backing dictionary.

    Declaration
    protected virtual int GetHashCodeInternal(TKey key)
    Parameters
    Type Name Description
    TKey key

    The key.

    Returns
    Type Description
    System.Int32

    Remove(TKey)

    Removes the specified key.

    Declaration
    public bool Remove(TKey key)
    Parameters
    Type Name Description
    TKey key

    The key.

    Returns
    Type Description
    System.Boolean
    Exceptions
    Type Condition
    System.InvalidOperationException

    Multiple matches found in collection

    TryGetValue(TKey, out TValue)

    Tries to get a value by key.

    Declaration
    public bool TryGetValue(TKey key, out TValue value)
    Parameters
    Type Name Description
    TKey key

    The key.

    TValue value

    The value.

    Returns
    Type Description
    System.Boolean

    On this page

    Back to top Generated by DocFX