Show / Hide Table of Contents

Struct MemoryOwner<T>

Represents unified representation of the memory rented using various types of memory pools.

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

The type of the items in the memory pool.

Constructors

| Improve this Doc View Source

MemoryOwner(T[])

Wraps the array as if it was rented.

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

The array to wrap.

| Improve this Doc View Source

MemoryOwner(T[], Int32)

Wraps the array as if it was rented.

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

The array to wrap.

Int32 length

The length of the array.

Exceptions
Type Condition
ArgumentOutOfRangeException

length is less than 0 or greater than the length of array.

| Improve this Doc View Source

MemoryOwner(ArrayPool<T>, Int32)

Rents the array from the pool.

Declaration
public MemoryOwner(ArrayPool<T> pool, int length)
Parameters
Type Name Description
ArrayPool<T> pool

The array pool.

Int32 length

The length of the array.

| Improve this Doc View Source

MemoryOwner(MemoryPool<T>, Int32)

Rents the memory from the pool.

Declaration
public MemoryOwner(MemoryPool<T> pool, int length = -1)
Parameters
Type Name Description
MemoryPool<T> pool

The memory pool.

Int32 length

The number of elements to rent; or -1 to rent default amount of memory.

| Improve this Doc View Source

MemoryOwner(Func<IMemoryOwner<T>>)

Rents the memory.

Declaration
public MemoryOwner(Func<IMemoryOwner<T>> provider)
Parameters
Type Name Description
Func<IMemoryOwner<T>> provider

The memory provider.

| Improve this Doc View Source

MemoryOwner(Func<Int32, IMemoryOwner<T>>, Int32)

Retns the memory.

Declaration
public MemoryOwner(Func<int, IMemoryOwner<T>> provider, int length)
Parameters
Type Name Description
Func<Int32, IMemoryOwner<T>> provider

The memory provider.

Int32 length

The number of elements to rent.

Properties

| Improve this Doc View Source

IsEmpty

Determines whether this memory is empty.

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

Item[Int32]

Gets managed pointer to the item in the rented memory.

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

The index of the element in memory.

Property Value
Type Description
T

The managed pointer to the item.

| Improve this Doc View Source

Length

Gets length of the rented memory, in bytes.

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

Memory

Gets the memory belonging to this owner.

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

The memory belonging to this owner.

Methods

| Improve this Doc View Source

Dispose()

Releases rented memory.

Declaration
public void Dispose()

Explicit Interface Implementations

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

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