Search Results for

    Show / Hide Table of Contents

    Struct ReadOnlyArray<T>

    Represents an immutable array.

    Implements
    IReadOnlyList<T>
    IReadOnlyCollection<T>
    IEnumerable<T>
    IEnumerable
    Inherited Members
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.GetType()
    Object.ReferenceEquals(Object, Object)
    Namespace: Microsoft.ML.Probabilistic.Collections
    Assembly: Microsoft.ML.Probabilistic.dll
    Syntax
    [Serializable]
    [DataContract]
    public struct ReadOnlyArray<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
    Type Parameters
    Name Description
    T
    Remarks

    This is a partial reimplementation of System.Collections.Immutable.ReadOnlyArray. Once we can move to netcore-only codebase, this type can be removed. API is supposed to be a subset of the real thing to ease migration in future.

    Properties

    Count

    Declaration
    public readonly int Count { get; }
    Property Value
    Type Description
    Int32

    Empty

    Declaration
    public static readonly ReadOnlyArray<T> Empty { get; }
    Property Value
    Type Description
    ReadOnlyArray<T>

    Item[Int32]

    Declaration
    public readonly T this[int index] { get; }
    Parameters
    Type Name Description
    Int32 index
    Property Value
    Type Description
    T

    Methods

    CloneArray()

    Creates a mutable copy of this array.

    Declaration
    public T[] CloneArray()
    Returns
    Type Description
    T[]

    CreateCopy(IEnumerable<T>)

    Creates a new instance of ReadOnlyArray<T> by copying elements of sequence.

    Declaration
    [Construction(new string[]{"CloneArray"})]
    public static ReadOnlyArray<T> CreateCopy(IEnumerable<T> sequence)
    Parameters
    Type Name Description
    IEnumerable<T> sequence
    Returns
    Type Description
    ReadOnlyArray<T>

    Equals(Object)

    Declaration
    public override bool Equals(object o)
    Parameters
    Type Name Description
    Object o
    Returns
    Type Description
    Boolean
    Overrides
    ValueType.Equals(Object)

    GetEnumerator()

    Returns enumerator over elements of array.

    Declaration
    public ReadOnlyArraySegmentEnumerator<T> GetEnumerator()
    Returns
    Type Description
    ReadOnlyArraySegmentEnumerator<T>
    Remarks

    This is value-type non-virtual version of enumerator that is used by compiler in foreach loops.

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32
    Overrides
    ValueType.GetHashCode()

    Operators

    Equality(ReadOnlyArray<T>, ReadOnlyArray<T>)

    Declaration
    public static bool operator ==(ReadOnlyArray<T> left, ReadOnlyArray<T> right)
    Parameters
    Type Name Description
    ReadOnlyArray<T> left
    ReadOnlyArray<T> right
    Returns
    Type Description
    Boolean

    Inequality(ReadOnlyArray<T>, ReadOnlyArray<T>)

    Declaration
    public static bool operator !=(ReadOnlyArray<T> left, ReadOnlyArray<T> right)
    Parameters
    Type Name Description
    ReadOnlyArray<T> left
    ReadOnlyArray<T> right
    Returns
    Type Description
    Boolean

    Explicit Interface Implementations

    IEnumerable<T>.GetEnumerator()

    Declaration
    IEnumerator<T> IEnumerable<T>.GetEnumerator()
    Returns
    Type Description
    IEnumerator<T>

    IEnumerable.GetEnumerator()

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    Implements

    System.Collections.Generic.IReadOnlyList<T>
    System.Collections.Generic.IReadOnlyCollection<T>
    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.