Search Results for

    Show / Hide Table of Contents

    Class PooledArray<T>

    RAII wrap for ArrayPool

    Inheritance
    System.Object
    PooledArray<T>
    Implements
    System.IDisposable
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IStructuralComparable
    System.Collections.IStructuralEquatable
    System.ICloneable
    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.IEquatable<PooledArray<T>>
    IClone<T[]>
    IMovable<PooledArray<T>>
    IBox<T[]>
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: LibSugar
    Assembly: LibSugar.dll
    Syntax
    public sealed class PooledArray<T> : IDisposable, IList, ICollection, IStructuralComparable, IStructuralEquatable, ICloneable, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IEquatable<PooledArray<T>>, IClone<T[]>, IMovable<PooledArray<T>>, IBox<T[]>
    Type Parameters
    Name Description
    T

    Properties

    | Improve this Doc View Source

    IsFixedSize

    Gets a value indicating whether the System.Array has a fixed size

    Declaration
    public bool IsFixedSize { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsMoved

    Has been moved

    Declaration
    public bool IsMoved { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsReadOnly

    Gets a value indicating whether the System.Array is read-only

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsSynchronized

    Gets a value indicating whether access to the System.Array is synchronized (thread safe)

    Declaration
    public bool IsSynchronized { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Item[Int32]

    Get value ref in array

    Declaration
    public ref T this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    Type Description
    T
    | Improve this Doc View Source

    Item[Int64]

    Get value ref in array

    Declaration
    public ref T this[long index] { get; }
    Parameters
    Type Name Description
    System.Int64 index
    Property Value
    Type Description
    T
    | Improve this Doc View Source

    Length

    Gets the total number of elements in all the dimensions of the System.Array

    Declaration
    public int Length { get; }
    Property Value
    Type Description
    System.Int32
    Exceptions
    Type Condition
    System.OverflowException

    The array is multidimensional and contains more than System.Int32.MaxValue elements

    | Improve this Doc View Source

    LongLength

    Gets a 64-bit integer that represents the total number of elements in all the dimensions of the System.Array

    Declaration
    public long LongLength { get; }
    Property Value
    Type Description
    System.Int64
    | Improve this Doc View Source

    Rank

    Gets the rank (number of dimensions) of the System.Array. For example, a one-dimensional array returns 1, a two-dimensional array returns 2, and so on

    Declaration
    public int Rank { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    SyncRoot

    Gets an object that can be used to synchronize access to the System.Array

    Declaration
    public object SyncRoot { get; }
    Property Value
    Type Description
    System.Object
    | Improve this Doc View Source

    Value

    The Array

    Declaration
    public T[] Value { get; }
    Property Value
    Type Description
    T[]

    Methods

    | Improve this Doc View Source

    AsMemory()

    Creates a new memory region over the target array.

    Declaration
    public Memory<T> AsMemory()
    Returns
    Type Description
    System.Memory<T>

    The memory representation of the whole or part of the array.

    | Improve this Doc View Source

    AsMemory(Index)

    Creates a new memory region over the portion of the target array starting at a specified index to the end of the array.

    Declaration
    public Memory<T> AsMemory(Index startIndex)
    Parameters
    Type Name Description
    System.Index startIndex

    The first position of the array.

    Returns
    Type Description
    System.Memory<T>

    The memory representation of the whole or part of the array.

    | Improve this Doc View Source

    AsMemory(Int32)

    Creates a new memory region over the portion of the target array starting at a specified position to the end of the array.

    Declaration
    public Memory<T> AsMemory(int start)
    Parameters
    Type Name Description
    System.Int32 start

    The index at which to begin the memory.

    Returns
    Type Description
    System.Memory<T>

    The memory representation of the whole or part of the array.

    Exceptions
    Type Condition
    System.ArrayTypeMismatchException

    array is covariant, and the array's type is not exactly T[].

    System.ArgumentOutOfRangeException

    start, length, or start + length is not in the range of array.

    | Improve this Doc View Source

    AsMemory(Int32, Int32)

    Creates a new memory region over the portion of the target array beginning at a specified position with a specified length.

    Declaration
    public Memory<T> AsMemory(int start, int length)
    Parameters
    Type Name Description
    System.Int32 start

    The index at which to begin the memory region.

    System.Int32 length

    The number of items in the memory region.

    Returns
    Type Description
    System.Memory<T>

    The memory representation of the whole or part of the array.

    Exceptions
    Type Condition
    System.ArrayTypeMismatchException

    array is covariant, and the array's type is not exactly T[].

    System.ArgumentOutOfRangeException

    start, length, or start + length is not in the range of array.

    | Improve this Doc View Source

    AsMemory(Range)

    Creates a new memory region over the portion of the target array beginning at inclusive start index of the range and ending at the exclusive end index of the range.

    Declaration
    public Memory<T> AsMemory(Range range)
    Parameters
    Type Name Description
    System.Range range

    The range to convert from the array.

    Returns
    Type Description
    System.Memory<T>

    The memory representation of the whole or part of the array.

    | Improve this Doc View Source

    AsSpan()

    Creates a new span over a target array.

    Declaration
    public Span<T> AsSpan()
    Returns
    Type Description
    System.Span<T>

    The span representation of the array.

    | Improve this Doc View Source

    AsSpan(Index)

    Creates a new span over the portion of the target array defined by an System.Index value.

    Declaration
    public Span<T> AsSpan(Index startIndex)
    Parameters
    Type Name Description
    System.Index startIndex

    The starting index.

    Returns
    Type Description
    System.Span<T>

    The span representation of the array.

    | Improve this Doc View Source

    AsSpan(Int32)

    Creates a new span over a portion of the target array starting at a specified position to the end of the array.

    Declaration
    public Span<T> AsSpan(int start)
    Parameters
    Type Name Description
    System.Int32 start

    The initial index from which the array will be converted.

    Returns
    Type Description
    System.Span<T>

    The span representation of the array.

    | Improve this Doc View Source

    AsSpan(Int32, Int32)

    Creates a new span over the portion of the target array beginning at a specified position for a specified length.

    Declaration
    public Span<T> AsSpan(int start, int length)
    Parameters
    Type Name Description
    System.Int32 start

    The index at which to begin the span.

    System.Int32 length

    The number of items in the span.

    Returns
    Type Description
    System.Span<T>

    The span representation of the array.

    Exceptions
    Type Condition
    System.ArrayTypeMismatchException

    array is covariant, and the array's type is not exactly T[]".

    System.ArgumentOutOfRangeException

    start, length, or start + length is not in the range of text.

    | Improve this Doc View Source

    AsSpan(Range)

    Creates a new span over a portion of a target array defined by a System.Range value.

    Declaration
    public Span<T> AsSpan(Range range)
    Parameters
    Type Name Description
    System.Range range

    The range of the array to convert.

    Returns
    Type Description
    System.Span<T>

    The span representation of the array.

    | Improve this Doc View Source

    Clone()

    Creates a shallow copy of the System.Array.

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

    A shallow copy of the System.Array.

    | Improve this Doc View Source

    CopyTo(Array, Int32)

    Copies all the elements of the current one-dimensional array to the specified one-dimensional array starting at the specified destination array index. The index is specified as a 32-bit integer.

    Declaration
    public void CopyTo(Array array, int index)
    Parameters
    Type Name Description
    System.Array array

    The one-dimensional array that is the destination of the elements copied from the current array.

    System.Int32 index

    A 32-bit integer that represents the index in array at which copying begins

    Exceptions
    Type Condition
    System.ArgumentNullException

    array is null

    System.ArgumentOutOfRangeException

    index is less than the lower bound of array

    System.ArgumentException

    array is multidimensional. -or- The number of elements in the source array is greater than the available number of elements from index to the end of the destination array

    System.ArrayTypeMismatchException

    The type of the source System.Array cannot be cast automatically to the type of the destination array

    System.RankException

    The source array is multidimensional

    System.InvalidCastException

    At least one element in the source System.Array cannot be cast to the type of destination array

    | Improve this Doc View Source

    CopyTo(Array, Int64)

    Copies all the elements of the current one-dimensional array to the specified one-dimensional array starting at the specified destination array index
    The index is specified as a 64-bit integer

    Declaration
    public void CopyTo(Array array, long index)
    Parameters
    Type Name Description
    System.Array array

    The one-dimensional array that is the destination of the elements copied from the current array

    System.Int64 index

    A 64-bit integer that represents the index in array at which copying begins

    Exceptions
    Type Condition
    System.ArgumentNullException

    array is null

    System.ArgumentOutOfRangeException

    index is outside the range of valid indexes for array

    System.ArgumentException

    array is multidimensional. -or- The number of elements in the source array is greater than the available number of elements from index to the end of the destination array

    System.ArrayTypeMismatchException

    The type of the source System.Array cannot be cast automatically to the type of the destination array

    System.RankException

    The source System.Array is multidimensional

    System.InvalidCastException

    At least one element in the source System.Array cannot be cast to the type of destination array

    | Improve this Doc View Source

    CopyTo(Memory<T>)

    Copies the contents of the array into a memory region.

    Declaration
    public void CopyTo(Memory<T> destination)
    Parameters
    Type Name Description
    System.Memory<T> destination

    The memory to copy items into.

    Exceptions
    Type Condition
    System.ArgumentException

    The destination is shorter than the source array

    | Improve this Doc View Source

    CopyTo(Span<T>)

    Copies the contents of the array into the span.

    Declaration
    public void CopyTo(Span<T> destination)
    Parameters
    Type Name Description
    System.Span<T> destination

    The span to copy items into.

    Exceptions
    Type Condition
    System.ArgumentException

    The destination Span is shorter than the source array

    | Improve this Doc View Source

    Dispose()

    Return the array

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    Equals(PooledArray<T>)

    Equals

    Declaration
    public bool Equals(PooledArray<T> other)
    Parameters
    Type Name Description
    PooledArray<T> other
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Equals(Object)

    Equals

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.Object.Equals(System.Object)
    | Improve this Doc View Source

    Finalize()

    Return the array

    Declaration
    protected void Finalize()
    | Improve this Doc View Source

    GetEnumerator()

    Returns an System.Collections.IEnumerator for the System.Array.

    Declaration
    public IEnumerator GetEnumerator()
    Returns
    Type Description
    System.Collections.IEnumerator

    An System.Collections.IEnumerator for the System.Array.

    | Improve this Doc View Source

    GetHashCode()

    GetHashCode

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.Object.GetHashCode()
    | Improve this Doc View Source

    Initialize()

    Initializes every element of the value-type System.Array by calling the parameterless constructor of the value type

    Declaration
    public void Initialize()
    | Improve this Doc View Source

    Move()

    Move, take ownership, original value will skip destruction

    Declaration
    public PooledArray<T> Move()
    Returns
    Type Description
    PooledArray<T>

    Operators

    | Improve this Doc View Source

    Equality(PooledArray<T>, PooledArray<T>)

    ==

    Declaration
    public static bool operator ==(PooledArray<T> left, PooledArray<T> right)
    Parameters
    Type Name Description
    PooledArray<T> left
    PooledArray<T> right
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Implicit(PooledArray<T> to T[])

    implicit to array

    Declaration
    public static implicit operator T[](PooledArray<T> self)
    Parameters
    Type Name Description
    PooledArray<T> self
    Returns
    Type Description
    T[]
    | Improve this Doc View Source

    Inequality(PooledArray<T>, PooledArray<T>)

    !=

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

    Explicit Interface Implementations

    | Improve this Doc View Source

    ICollection<T>.Add(T)

    Declaration
    void ICollection<T>.Add(T item)
    Parameters
    Type Name Description
    T item
    | Improve this Doc View Source

    ICollection<T>.Clear()

    Declaration
    void ICollection<T>.Clear()
    | Improve this Doc View Source

    ICollection<T>.Contains(T)

    Declaration
    bool ICollection<T>.Contains(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ICollection<T>.CopyTo(T[], Int32)

    Declaration
    void ICollection<T>.CopyTo(T[] array, int arrayIndex)
    Parameters
    Type Name Description
    T[] array
    System.Int32 arrayIndex
    | Improve this Doc View Source

    ICollection<T>.Count

    Declaration
    int ICollection<T>.Count { get; }
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    ICollection<T>.Remove(T)

    Declaration
    bool ICollection<T>.Remove(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IEnumerable<T>.GetEnumerator()

    Declaration
    IEnumerator<T> IEnumerable<T>.GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<T>
    | Improve this Doc View Source

    IList<T>.IndexOf(T)

    Declaration
    int IList<T>.IndexOf(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    IList<T>.Insert(Int32, T)

    Declaration
    void IList<T>.Insert(int index, T item)
    Parameters
    Type Name Description
    System.Int32 index
    T item
    | Improve this Doc View Source

    IList<T>.Item[Int32]

    Declaration
    T IList<T>.this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    T
    | Improve this Doc View Source

    IList<T>.RemoveAt(Int32)

    Declaration
    void IList<T>.RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index
    | Improve this Doc View Source

    IReadOnlyCollection<T>.Count

    Declaration
    int IReadOnlyCollection<T>.Count { get; }
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    IReadOnlyList<T>.Item[Int32]

    Declaration
    T IReadOnlyList<T>.this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    T
    | Improve this Doc View Source

    ICollection.Count

    Declaration
    int ICollection.Count { get; }
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    IList.Add(Object)

    Declaration
    int IList.Add(object value)
    Parameters
    Type Name Description
    System.Object value
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    IList.Clear()

    Declaration
    void IList.Clear()
    | Improve this Doc View Source

    IList.Contains(Object)

    Declaration
    bool IList.Contains(object value)
    Parameters
    Type Name Description
    System.Object value
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IList.IndexOf(Object)

    Declaration
    int IList.IndexOf(object value)
    Parameters
    Type Name Description
    System.Object value
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    IList.Insert(Int32, Object)

    Declaration
    void IList.Insert(int index, object value)
    Parameters
    Type Name Description
    System.Int32 index
    System.Object value
    | Improve this Doc View Source

    IList.Item[Int32]

    Declaration
    object IList.this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    System.Object
    | Improve this Doc View Source

    IList.Remove(Object)

    Declaration
    void IList.Remove(object value)
    Parameters
    Type Name Description
    System.Object value
    | Improve this Doc View Source

    IList.RemoveAt(Int32)

    Declaration
    void IList.RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index
    | Improve this Doc View Source

    IStructuralComparable.CompareTo(Object, IComparer)

    Declaration
    int IStructuralComparable.CompareTo(object other, IComparer comparer)
    Parameters
    Type Name Description
    System.Object other
    System.Collections.IComparer comparer
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    IStructuralEquatable.Equals(Object, IEqualityComparer)

    Declaration
    bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
    Parameters
    Type Name Description
    System.Object other
    System.Collections.IEqualityComparer comparer
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IStructuralEquatable.GetHashCode(IEqualityComparer)

    Declaration
    int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
    Parameters
    Type Name Description
    System.Collections.IEqualityComparer comparer
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    ICloneable.Clone()

    Creates a shallow copy of the System.Array.

    Declaration
    object ICloneable.Clone()
    Returns
    Type Description
    System.Object

    A shallow copy of the System.Array.

    Implements

    System.IDisposable
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IStructuralComparable
    System.Collections.IStructuralEquatable
    System.ICloneable
    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.IEquatable<T>
    IClone<T>
    IMovable<T>
    IBox<T>

    Extension Methods

    Sugar.Borrow<T>(T)
    Sugar.Owner<T>(T)
    Sugar.AssertEq<T>(T, T)
    Sugar.AssertNe<T>(T, T)
    Sugar.AssertSame<T>(T, T)
    Sugar.AssertNotSame<T>(T, T)
    Sugar.Box<T>(T)
    Sugar.Ref<T>(T)
    Sugar.Let<T, U>(T, Func<T, U>)
    Sugar.LetIf<T>(T, Boolean, Func<T, T>)
    Sugar.Also<T>(T, Action<T>)
    Sugar.AlsoIf<T>(T, Boolean, Action<T>)
    Sugar.SeqCloned<T, R>(IEnumerable<T>)
    Sugar.Movable<T>(T)
    Sugar.MovableBy<T>(T, MovableBy<T>.Drop)
    Sugar.Move<T, R>(IEnumerable<T>)
    Sugar.Seq<T>(T)
    Sugar.Seq<T>(T, T[])
    Sugar.Repeat<T>(T, Int32)
    Sugar.JoinStr<T>(IEnumerable<T>)
    Sugar.JoinStr<T>(IEnumerable<T>, Char)
    Sugar.JoinStr<T>(IEnumerable<T>, String)
    Sugar.Indexed<T>(IEnumerable<T>)
    Sugar.WhereSelect<T, R>(IEnumerable<T>, Func<T, Option<R>>)
    Sugar.WhereCast<T, R>(IEnumerable<T>)
    Sugar.WhereCast<R>(IEnumerable)
    Sugar.ForEach<T>(IEnumerable<T>, Action<T>)
    Sugar.ForEach<T>(IEnumerable<T>, Func<T, Boolean>)
    Sugar.ForEach<T, R>(IEnumerable<T>, Func<T, Option<R>>)
    Sugar.DistinctBy<T, D>(IEnumerable<T>, Func<T, D>)
    Sugar.DistinctBy<T, D>(IEnumerable<T>, IEqualityComparer<D>, Func<T, D>)
    Sugar.DistinctBy<T, D>(IEnumerable<T>, Func<T, D>, IEqualityComparer<D>)
    Sugar.UnionBy<T, D>(IEnumerable<T>, IEnumerable<T>, Func<T, D>)
    Sugar.UnionBy<T, D>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<D>, Func<T, D>)
    Sugar.UnionBy<T, D>(IEnumerable<T>, IEnumerable<T>, Func<T, D>, IEqualityComparer<D>)
    Sugar.ExceptBy<T, D>(IEnumerable<T>, IEnumerable<T>, Func<T, D>)
    Sugar.ExceptBy<T, D>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<D>, Func<T, D>)
    Sugar.ExceptBy<T, D>(IEnumerable<T>, IEnumerable<T>, Func<T, D>, IEqualityComparer<D>)
    Sugar.IntersectBy<T, D>(IEnumerable<T>, IEnumerable<T>, Func<T, D>)
    Sugar.IntersectBy<T, D>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<D>, Func<T, D>)
    Sugar.IntersectBy<T, D>(IEnumerable<T>, IEnumerable<T>, Func<T, D>, IEqualityComparer<D>)
    SugarClass.AssertNull<T>(T)
    SugarClass.AssertNonNull<T>(T)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © LibSugar.
    Generated by DocFX