ArrayPoolExtensions.Resize<T> 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.
Changes the number of elements of a rented one-dimensional array to the specified new size.
public static void Resize<T> (this System.Buffers.ArrayPool<T> pool, ref T[]? array, int newSize, bool clearArray = false);
static member Resize : System.Buffers.ArrayPool<'T> * T[] * int * bool -> unit
<Extension()>
Public Sub Resize(Of T) (pool As ArrayPool(Of T), ByRef array As T(), newSize As Integer, Optional clearArray As Boolean = false)
Type Parameters
- T
The type of items into the target array to resize.
Parameters
- pool
- ArrayPool<T>
The target ArrayPool<T> instance to use to resize the array.
- array
- T[]
The rented T
array to resize, or null
to create a new array.
- newSize
- Int32
The size of the new array.
- clearArray
- Boolean
Indicates whether the contents of the array should be cleared before reuse.
Exceptions
Thrown when newSize
is less than 0.
Remarks
When this method returns, the caller must not use any references to the old array anymore.