SpanOwner<T>.Allocate Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Allocate(Int32) |
Creates a new SpanOwner<T> instance with the specified parameters. |
Allocate(Int32, AllocationMode) |
Creates a new SpanOwner<T> instance with the specified parameters. |
Allocate(Int32, ArrayPool<T>) |
Creates a new SpanOwner<T> instance with the specified parameters. |
Allocate(Int32, ArrayPool<T>, AllocationMode) |
Creates a new SpanOwner<T> instance with the specified parameters. |
Allocate(Int32)
Creates a new SpanOwner<T> instance with the specified parameters.
public static CommunityToolkit.HighPerformance.Buffers.SpanOwner<T> Allocate (int size);
static member Allocate : int -> CommunityToolkit.HighPerformance.Buffers.SpanOwner<'T>
Public Shared Function Allocate (size As Integer) As SpanOwner(Of T)
Parameters
- size
- Int32
The length of the new memory buffer to use.
Returns
A SpanOwner<T> instance of the requested length.
Exceptions
Thrown when size
is not valid.
Remarks
This method is just a proxy for the private
constructor, for clarity.
Applies to
Allocate(Int32, AllocationMode)
Creates a new SpanOwner<T> instance with the specified parameters.
public static CommunityToolkit.HighPerformance.Buffers.SpanOwner<T> Allocate (int size, CommunityToolkit.HighPerformance.Buffers.AllocationMode mode);
static member Allocate : int * CommunityToolkit.HighPerformance.Buffers.AllocationMode -> CommunityToolkit.HighPerformance.Buffers.SpanOwner<'T>
Public Shared Function Allocate (size As Integer, mode As AllocationMode) As SpanOwner(Of T)
Parameters
- size
- Int32
The length of the new memory buffer to use.
- mode
- AllocationMode
Indicates the allocation mode to use for the new buffer to rent.
Returns
A SpanOwner<T> instance of the requested length.
Exceptions
Thrown when size
is not valid.
Remarks
This method is just a proxy for the private
constructor, for clarity.
Applies to
Allocate(Int32, ArrayPool<T>)
Creates a new SpanOwner<T> instance with the specified parameters.
public static CommunityToolkit.HighPerformance.Buffers.SpanOwner<T> Allocate (int size, System.Buffers.ArrayPool<T> pool);
static member Allocate : int * System.Buffers.ArrayPool<'T> -> CommunityToolkit.HighPerformance.Buffers.SpanOwner<'T>
Public Shared Function Allocate (size As Integer, pool As ArrayPool(Of T)) As SpanOwner(Of T)
Parameters
- size
- Int32
The length of the new memory buffer to use.
- pool
- ArrayPool<T>
The ArrayPool<T> instance to use.
Returns
A SpanOwner<T> instance of the requested length.
Exceptions
Thrown when size
is not valid.
Remarks
This method is just a proxy for the private
constructor, for clarity.
Applies to
Allocate(Int32, ArrayPool<T>, AllocationMode)
Creates a new SpanOwner<T> instance with the specified parameters.
public static CommunityToolkit.HighPerformance.Buffers.SpanOwner<T> Allocate (int size, System.Buffers.ArrayPool<T> pool, CommunityToolkit.HighPerformance.Buffers.AllocationMode mode);
static member Allocate : int * System.Buffers.ArrayPool<'T> * CommunityToolkit.HighPerformance.Buffers.AllocationMode -> CommunityToolkit.HighPerformance.Buffers.SpanOwner<'T>
Public Shared Function Allocate (size As Integer, pool As ArrayPool(Of T), mode As AllocationMode) As SpanOwner(Of T)
Parameters
- size
- Int32
The length of the new memory buffer to use.
- pool
- ArrayPool<T>
The ArrayPool<T> instance to use.
- mode
- AllocationMode
Indicates the allocation mode to use for the new buffer to rent.
Returns
A SpanOwner<T> instance of the requested length.
Exceptions
Thrown when size
is not valid.
Remarks
This method is just a proxy for the private
constructor, for clarity.