Represents unified representation of the memory rented using various types of memory pools.
Namespace: DotNext.Buffers Assembly: DotNext.dll Syntaxpublic struct MemoryOwner<T> : IMemoryOwner<T>, IDisposable, ISupplier<Memory<T>>, IFunctional<Func<Memory<T>>>, ISupplier<ReadOnlyMemory<T>>, IFunctional<Func<ReadOnlyMemory<T>>>
Type Parameters Name Description T
The type of the items in the memory pool.
Constructors | Edit this page View Source MemoryOwner(ArrayPool<T>, int)Rents the array from the pool.
Declarationpublic MemoryOwner(ArrayPool<T> pool, int length)
Parameters Type Name Description ArrayPool<T> pool
The array pool.
int lengthThe length of the array.
| Edit this page View Source MemoryOwner(MemoryPool<T>, int)Rents the memory from the pool.
Declarationpublic MemoryOwner(MemoryPool<T> pool, int length = -1)
Parameters Type Name Description MemoryPool<T> pool
The memory pool.
int lengthThe number of elements to rent; or -1
to rent default amount of memory.
Rents the memory.
Declarationpublic MemoryOwner(Func<IMemoryOwner<T>> provider)
Parameters | Edit this page View Source MemoryOwner(Func<int, IMemoryOwner<T>>, int)
Rents the memory.
Declarationpublic MemoryOwner(Func<int, IMemoryOwner<T>> provider, int length)
Parameters Type Name Description Func<int, IMemoryOwner<T>> provider
The memory provider.
int lengthThe number of elements to rent.
| Edit this page View Source MemoryOwner(T[])Wraps the array as if it was rented.
Declarationpublic MemoryOwner(T[] array)
Parameters Type Name Description T[] array
The array to wrap.
| Edit this page View Source MemoryOwner(T[], int)Wraps the array as if it was rented.
Declarationpublic MemoryOwner(T[] array, int length)
Parameters Type Name Description T[] array
The array to wrap.
int lengthThe length of the array.
Exceptions Properties | Edit this page View Source IsEmptyDetermines whether this memory is empty.
Declarationpublic readonly bool IsEmpty { get; }
Property Value | Edit this page View Source this[int]
Gets managed pointer to the item in the rented memory.
Declarationpublic readonly ref T this[int index] { get; }
Parameters Type Name Description int index
The index of the element in memory.
Property Value Type Description TThe managed pointer to the item.
Exceptions | Edit this page View Source LengthGets numbers of elements in the rented memory block.
Declarationpublic readonly int Length { get; }
Property Value | Edit this page View Source Memory
Gets the memory belonging to this owner.
Declarationpublic readonly Memory<T> Memory { get; }
Property Value Type Description Memory<T>
The memory belonging to this owner.
| Edit this page View Source SpanGets the span over the memory belonging to this owner.
Declarationpublic readonly Span<T> Span { get; }
Property Value Type Description Span<T>
The span over the memory belonging to this owner.
Methods | Edit this page View Source Dispose()Releases rented memory.
Declaration | Edit this page View Source ToString()Returns the fully qualified type name of this instance.
Declarationpublic override readonly string ToString()
Returns Type Description string
The fully qualified type name.
Overrides | Edit this page View Source TryResize(int)Attempts to resize this buffer without reallocation.
Declarationpublic bool TryResize(int newLength)
Parameters Type Name Description int newLength
The requested length of this buffer.
Returns Type Description booltrue if this buffer is resized successfully; otherwise, false.
Exceptions Implements Extension MethodsRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4