GC.AllocateUninitializedArray<T>(Int32, Boolean) Method

Definition

Allocates an array while skipping zero-initialization, if possible.

public static T[] AllocateUninitializedArray<T> (int length, bool pinned = false);
static member AllocateUninitializedArray : int * bool -> 'T[]
Public Shared Function AllocateUninitializedArray(Of T) (length As Integer, Optional pinned As Boolean = false) As T()

Type Parameters

T

Specifies the type of the array element.

Parameters

length
Int32

Specifies the length of the array.

pinned
Boolean

Specifies whether the allocated array must be pinned.

Returns

T[]

An array object with uninitialized memory except if it contains references or if it's too small for unpinned.

Remarks

If pinned is set to true, T must not be a reference type or a type that contains object references.

Applies to