Share via


ArrayRecord.GetArray(Type, Boolean) Method

Definition

Allocates an array and fills it with the data provided in the serialized records (in case of primitive types like String or Int32) or the serialized records themselves.

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public Array GetArray(Type expectedArrayType, bool allowNulls = true);
public Array GetArray(Type expectedArrayType, bool allowNulls = true);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")>]
member this.GetArray : Type * bool -> Array
member this.GetArray : Type * bool -> Array
Public Function GetArray (expectedArrayType As Type, Optional allowNulls As Boolean = true) As Array

Parameters

expectedArrayType
Type

Expected array type.

allowNulls
Boolean

true to permit null values within the array; otherwise, false.

Returns

An array filled with the data provided in the serialized records.

Attributes

Exceptions

expectedArrayType does not match the data from the payload.

Remarks

Before calling this method, check the total length of the array by using the Lengths property. An attacker could have sent a small payload that requires allocation of a very large array, which could cause OutOfMemoryException and denial of service.

Applies to