Search Results for

    Show / Hide Table of Contents

    Class FileArray<T>

    An IArray where each element is stored as a disk file.

    Inheritance
    Object
    FileArray<T>
    DistributionFileArray<T, DomainType>
    Implements
    IArray<T>
    IList<T>
    ICollection<T>
    IReadOnlyList<T>
    IReadOnlyCollection<T>
    IEnumerable<T>
    IEnumerable
    IDisposable
    ICloneable
    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
    [Serializable]
    public class FileArray<T> : IArray<T>, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IDisposable, ICloneable
    Type Parameters
    Name Description
    T

    The element type

    Remarks

    The elements (whose values do not equal default(T)) are stored as individual files in a temp folder. Elements equal to default(T) are not stored. A FileArray may contain FileArrays as elements: these are called child FileArrays. Child FileArrays must be created using the special constructor. When a FileArray (that is not a child) is Disposed or garbage collected, the folder is deleted. A child FileArray is deleted only when its parent is deleted. Thus if the program exits normally, all temp folders should be deleted. However, if the program halts with an exception, temp folders will not be deleted and must be cleaned up manually.

    Be careful when modifying elements of the FileArray in place. If fa is a FileArray, then the syntax

    fa[i][j] = 0;
    or
    fa[i].property = 0;
    will not have any effect. This happens because
    fa[i]
    reads the element from disk but does not write it back again. You must explicitly read the element, modify it, then write it back like so:
    T item = fa[i];  item.property=0;  fa[i] = item;

    Constructors

    FileArray(FileArray<FileArray<T>>, Int32, Int32)

    Declaration
    public FileArray(FileArray<FileArray<T>> parent, int index, int count)
    Parameters
    Type Name Description
    FileArray<FileArray<T>> parent
    Int32 index
    Int32 count

    FileArray(String, Int32)

    Declaration
    public FileArray(string folder, int count)
    Parameters
    Type Name Description
    String folder
    Int32 count

    FileArray(String, Int32, Func<Int32, T>)

    Create a file array

    Declaration
    public FileArray(string folder, int count, Func<int, T> func)
    Parameters
    Type Name Description
    String folder

    Temporary folder for storing data. Will be deleted when the FileArray is disposed.

    Int32 count
    Func<Int32, T> func

    Fields

    count

    Declaration
    protected readonly int count
    Field Value
    Type Description
    Int32

    doNotDelete

    Declaration
    protected bool doNotDelete
    Field Value
    Type Description
    Boolean

    prefix

    Declaration
    protected readonly string prefix
    Field Value
    Type Description
    String

    Properties

    Count

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

    Folder

    Declaration
    public string Folder { get; }
    Property Value
    Type Description
    String

    IsReadOnly

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    Boolean

    Item[Int32]

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

    Rank

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

    Methods

    Add(T)

    Declaration
    public void Add(T item)
    Parameters
    Type Name Description
    T item

    Clear()

    Declaration
    public void Clear()

    Clone()

    Declaration
    public virtual object Clone()
    Returns
    Type Description
    Object

    Contains(T)

    Declaration
    public bool Contains(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    Boolean

    CopyTo(T[], Int32)

    Declaration
    public void CopyTo(T[] array, int arrayIndex)
    Parameters
    Type Name Description
    T[] array
    Int32 arrayIndex

    Dispose()

    Declaration
    public void Dispose()

    Finalize()

    Declaration
    protected void Finalize()

    GetEnumerator()

    Declaration
    public IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    IEnumerator<T>

    GetLength(Int32)

    Declaration
    public int GetLength(int dimension)
    Parameters
    Type Name Description
    Int32 dimension
    Returns
    Type Description
    Int32

    GetTempFolder(String)

    Declaration
    public static string GetTempFolder(string name)
    Parameters
    Type Name Description
    String name
    Returns
    Type Description
    String

    IndexOf(T)

    Declaration
    public int IndexOf(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    Int32

    Insert(Int32, T)

    Declaration
    public void Insert(int index, T item)
    Parameters
    Type Name Description
    Int32 index
    T item

    Remove(T)

    Declaration
    public bool Remove(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    Boolean

    RemoveAt(Int32)

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    Int32 index

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    Implements

    IArray<T>
    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IReadOnlyList<T>
    System.Collections.Generic.IReadOnlyCollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    System.IDisposable
    System.ICloneable

    Extension Methods

    CollectionExtensions.AddRange<T>(ICollection<T>, IEnumerable<T>)
    CollectionExtensions.ContainsAll<T>(ICollection<T>, IEnumerable<T>)
    CollectionExtensions.ContainsAny<T>(ICollection<T>, IEnumerable<T>)
    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>)
    IEnumerableExensions.ListZip<TFirst, TSecond, TResult>(IList<TFirst>, IEnumerable<TSecond>, Func<TFirst, TSecond, TResult>)
    IEnumerableExensions.ListZip<TFirst, TSecond, TThird, TResult>(IList<TFirst>, IEnumerable<TSecond>, IEnumerable<TThird>, Func<TFirst, TSecond, TThird, TResult>)
    IEnumerableExensions.ListZip<TFirst, TSecond, TThird, TFourth, TResult>(IList<TFirst>, IList<TSecond>, IList<TThird>, IList<TFourth>, Func<TFirst, TSecond, TThird, TFourth, TResult>)
    IListExtensions.IsSparse<T>(IList<T>)
    IListExtensions.ListSelect<T, T2>(IList<T>, Func<T, T2>)
    IListExtensions.ListReduce<T, TRes>(IList<T>, TRes, Func<TRes, T, TRes>)
    IListExtensions.ListReduce<T, T2, TRes>(IList<T>, IEnumerable<T2>, TRes, Func<TRes, T, T2, TRes>)
    IListExtensions.SetTo<T>(IList<T>, IEnumerable<T>)
    IListExtensions.AsReadOnly<T>(IList<T>)
    ReadOnlyArray.ToReadOnlyArray<T>(IEnumerable<T>)
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.