Show / Hide Table of Contents

Struct ArrayRental<T>

Represents array obtained from array pool.

Implements
IMemoryOwner<T>
IDisposable
IConvertible<Memory<T>>
IConvertible<ArraySegment<T>>
IConvertible<MemoryOwner<T>>
Inherited Members
ValueType.Equals(Object)
ValueType.GetHashCode()
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
Namespace: DotNext.Buffers
Assembly: DotNext.dll
Syntax
public struct ArrayRental<T> : IMemoryOwner<T>, IDisposable, IConvertible<Memory<T>>, IConvertible<ArraySegment<T>>, IConvertible<MemoryOwner<T>>
Type Parameters
Name Description
T

Type of array elements.

Constructors

| Improve this Doc View Source

ArrayRental(T[])

Rents the array.

Declaration
public ArrayRental(T[] array)
Parameters
Type Name Description
T[] array

The array to rent.

| Improve this Doc View Source

ArrayRental(T[], Int32)

Rents the array.

Declaration
public ArrayRental(T[] array, int length)
Parameters
Type Name Description
T[] array

The array to rent.

Int32 length

The length of the rented segment.

Exceptions
Type Condition
ArgumentNullException

array is null.

ArgumentOutOfRangeException

length is greater than the length of array.

| Improve this Doc View Source

ArrayRental(ArrayPool<T>, Int32)

Obtains a new array from array pool.

Declaration
public ArrayRental(ArrayPool<T> pool, int minimumLength)
Parameters
Type Name Description
ArrayPool<T> pool

Array pool.

Int32 minimumLength

The minimum length of the array.

Exceptions
Type Condition
ArgumentNullException

pool is null.

| Improve this Doc View Source

ArrayRental(ArrayPool<T>, Int32, Boolean)

Obtains a new array from array pool.

Declaration
public ArrayRental(ArrayPool<T> pool, int minimumLength, bool clearArray)
Parameters
Type Name Description
ArrayPool<T> pool

Array pool.

Int32 minimumLength

The minimum length of the array.

Boolean clearArray

Indicates whether the contents of the array should be cleared after calling of Dispose().

Exceptions
Type Condition
ArgumentNullException

pool is null.

| Improve this Doc View Source

ArrayRental(Int32)

Obtains a new array from Shared.

Declaration
public ArrayRental(int minimumLength)
Parameters
Type Name Description
Int32 minimumLength

The minimum length of the array.

| Improve this Doc View Source

ArrayRental(Int32, Boolean)

Obtains a new array from Shared.

Declaration
public ArrayRental(int minimumLength, bool clearArray)
Parameters
Type Name Description
Int32 minimumLength

The minimum length of the array.

Boolean clearArray

Indicates whether the contents of the array should be cleared after calling of Dispose().

Properties

| Improve this Doc View Source

IsEmpty

Gets value indicating that this object is empty.

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

Item[Int64]

Gets the array element by its index.

Declaration
public T this[long index] { get; }
Parameters
Type Name Description
Int64 index

The index of the array element.

Property Value
Type Description
T

The managed pointer to the array element.

| Improve this Doc View Source

Length

Gets length of the rented array.

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

Memory

Gets the memory associated with the rented array.

Declaration
public Memory<T> Memory { get; }
Property Value
Type Description
Memory<T>
| Improve this Doc View Source

Owner

Converts this instance to MemoryOwner<T>.

Declaration
public MemoryOwner<T> Owner { get; }
Property Value
Type Description
MemoryOwner<T>
| Improve this Doc View Source

Segment

Gets the rented array.

Declaration
public ArraySegment<T> Segment { get; }
Property Value
Type Description
ArraySegment<T>
| Improve this Doc View Source

Span

Gets the span of array elements.

Declaration
public Span<T> Span { get; }
Property Value
Type Description
Span<T>

Methods

| Improve this Doc View Source

Clear()

Sets all elements of the rented array to default value of type T.

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

Dispose()

Returns the array back to the pool.

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

ToString()

Gets textual representation of the rented memory.

Declaration
public override string ToString()
Returns
Type Description
String

The textual representation of the rented memory.

Overrides
ValueType.ToString()

Operators

| Improve this Doc View Source

Implicit(ArrayRental<T> to MemoryOwner<T>)

Converts rented array to the memory owner.

Declaration
public static implicit operator MemoryOwner<T>(in ArrayRental<T> array)
Parameters
Type Name Description
ArrayRental<T> array

The rented array.

Returns
Type Description
MemoryOwner<T>

The array owner.

Explicit Interface Implementations

| Improve this Doc View Source

IConvertible<MemoryOwner<T>>.Convert()

Declaration
MemoryOwner<T> IConvertible<MemoryOwner<T>>.Convert()
Returns
Type Description
MemoryOwner<T>
| Improve this Doc View Source

IConvertible<ArraySegment<T>>.Convert()

Declaration
ArraySegment<T> IConvertible<ArraySegment<T>>.Convert()
Returns
Type Description
ArraySegment<T>
| Improve this Doc View Source

IConvertible<Memory<T>>.Convert()

Declaration
Memory<T> IConvertible<Memory<T>>.Convert()
Returns
Type Description
Memory<T>

Implements

System.Buffers.IMemoryOwner<T>
System.IDisposable
IConvertible<T>
IConvertible<T>
IConvertible<T>

Extension Methods

Sequence.Skip<TEnumerator, T>(ref TEnumerator, Int32)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX