Search Results for

    Show / Hide Table of Contents

    Class ArrayDictionary<T>

    Represents a dictionary with non-negative integers as keys.

    Inheritance
    Object
    ArrayDictionary<T>
    Implements
    IEnumerable<KeyValuePair<Int32, T>>
    IEnumerable
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Microsoft.ML.Probabilistic.Collections
    Assembly: Microsoft.ML.Probabilistic.dll
    Syntax
    public class ArrayDictionary<T> : IEnumerable<KeyValuePair<int, T>>, IEnumerable
    Type Parameters
    Name Description
    T

    The type of a value.

    Remarks

    This structure is efficient when the keys are zero-based and consecutive, since the dictionary is represented by an array under the hood.

    Constructors

    ArrayDictionary()

    Initializes a new instance of the ArrayDictionary<T> class.

    Declaration
    public ArrayDictionary()

    ArrayDictionary(Int32)

    Initializes a new instance of the ArrayDictionary<T> class with a given capacity.

    Declaration
    public ArrayDictionary(int capacity)
    Parameters
    Type Name Description
    Int32 capacity

    The capacity.

    Properties

    Item[Int32]

    Gets or sets the value associated with a given key.

    Declaration
    public T this[int key] { get; set; }
    Parameters
    Type Name Description
    Int32 key

    The key of the value to get or set.

    Property Value
    Type Description
    T

    The value associated with the specified key.

    Methods

    Add(Int32, T)

    Adds a given key and value to the dictionary.

    Declaration
    public void Add(int key, T value)
    Parameters
    Type Name Description
    Int32 key

    The key of the element to add.

    T value

    The value of the element to add. The value can be null for reference types.

    ContainsKey(Int32)

    Determines whether the dictionary contains a given key.

    Declaration
    public bool ContainsKey(int key)
    Parameters
    Type Name Description
    Int32 key

    The key to locate.

    Returns
    Type Description
    Boolean

    true if the dictionary contains an element with the specified key; otherwise, false.

    GetEnumerator()

    Returns an enumerator that iterates through the dictionary in ascending key order.

    Declaration
    public IEnumerator<KeyValuePair<int, T>> GetEnumerator()
    Returns
    Type Description
    IEnumerator<KeyValuePair<Int32, T>>

    An enumerator for the dictionary.

    TryGetValue(Int32, out T)

    Gets the value associated with a given key.

    Declaration
    public bool TryGetValue(int key, out T value)
    Parameters
    Type Name Description
    Int32 key

    The key of the value to get.

    T value

    When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.

    Returns
    Type Description
    Boolean

    true if the dictionary contains an element with the specified key; otherwise, false.

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Returns an enumerator that iterates through the dictionary in ascending key order.

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    An enumerator for the dictionary.

    Implements

    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable

    Extension Methods

    EnumerableExtensions.ForEach<T>(IEnumerable<T>, Action<T>)
    EnumerableExtensions.ForEach<T>(IEnumerable, Action<T>)
    EnumerableExtensions.ForEach<T>(IEnumerable<T>, Action<Int32, T>)
    EnumerableExtensions.ForEach<T>(IEnumerable, Action<Int32, T>)
    EnumerableExtensions.Sum<TSource>(IEnumerable<TSource>, Func<TSource, UInt32>)
    EnumerableExtensions.Sum<TSource>(IEnumerable<TSource>, Func<TSource, UInt64>)
    EnumerableExtensions.ValueEquals<T>(IEnumerable<T>, IEnumerable<T>)
    EnumerableExtensions.IndexOf<T>(IEnumerable<T>, T)
    EnumerableExtensions.IndexOf<T>(IEnumerable, T)
    EnumerableExtensions.FindIndex<T>(IEnumerable<T>, Predicate<T>)
    EnumerableExtensions.FindIndex<T>(IEnumerable, Predicate<T>)
    EnumerableExtensions.FindAllIndex<T>(IEnumerable<T>, Predicate<T>)
    EnumerableExtensions.IndexOfAll<T>(IEnumerable<T>, T)
    EnumerableExtensions.Skip<T>(IEnumerable<T>, Int32, out List<T>)
    EnumerableExtensions.CopyTo<T>(IEnumerable<T>, T[], Int32)
    EnumerableExtensions.ToReadOnlyList<T>(IEnumerable<T>)
    IEnumerableExensions.EnumerableReduce<T, TRes>(IEnumerable<T>, TRes, Func<TRes, T, TRes>, Func<TRes, T, Int32, TRes>)
    IEnumerableExensions.EnumerableSum<T>(IEnumerable<T>, Func<T, Double>)
    ReadOnlyArray.ToReadOnlyArray<T>(IEnumerable<T>)
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.