Show / Hide Table of Contents

Struct ArrayRental<T>

Represents array obtained from array pool.

Implements
IDisposable
Namespace: DotNext.Buffers
Assembly: DotNext.dll
Syntax
public struct ArrayRental<T> : IDisposable
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.

| 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 = false)
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().

| Improve this Doc View Source

ArrayRental(Int32, Boolean)

Obtains a new array from .

Declaration
public ArrayRental(int minimumLength, bool clearArray = false)
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

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
DotNext.Span<T>

Methods

| Improve this Doc View Source

Dispose()

Returns the array back to the pool.

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

GetPinnableReference()

Obtains managed pointer to the first element of the rented array.

Declaration
public T GetPinnableReference()
Returns
Type Description
T

The managed pointer to the first element of the rented array.

| Improve this Doc View Source

Slice(Int32, Int32)

Returns a slice of the rented array.

Declaration
public ArraySegment<T> Slice(int offset, int count)
Parameters
Type Name Description
Int32 offset

The zero-based index of the first element in the array.

Int32 count

The number of elements in the range.

Returns
Type Description
ArraySegment<T>

The segment of the rented array.

| 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.

Operators

| Improve this Doc View Source

Explicit(ArrayRental<T> to T[])

Obtains rented array.

Declaration
public static explicit operator T[](in ArrayRental<T> rental)
Parameters
Type Name Description
ArrayRental<T> rental

Array rental.

Returns
Type Description
T[]
Remarks

This operation is potentially unsafe because the length of the returned array may differs from Length.

Implements

IDisposable

Extension Methods

ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX