Function UnsafeSpan.Reallocate

Reallocate (Allocator allocator, int newSize)

Returns a new span with a different size, copies the current data over to it, and frees this span.

Public
unsafeUnsafeSpan<T> Reallocate (

Allocator

allocator

int

newSize

)

Returns a new span with a different size, copies the current data over to it, and frees this span.

The new span may be larger or smaller than the current span. If it is larger, the new elements will be uninitialized.

Warning

The span must have been allocated using the specified allocator.

You must never use the old span (or any other span referencing the same memory) again after calling this method.

Return

The new span.