ArrayRecord.GetArray(Type, Boolean) 方法

定義

分配一個陣列,並填滿序列化記錄(如 or Int32等原始型態String)或序列化記錄本身所提供的資料。

[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

參數

expectedArrayType
Type

預期陣列類型。

allowNulls
Boolean

true允許null陣列內有數值;否則,。 false

傳回

一個陣列,裡面充滿序列化記錄中提供的資料。

屬性

例外狀況

expectedArrayType 與有效載荷資料不符。

備註

在呼叫此方法之前,請利用 屬性 Lengths 檢查陣列的總長度。 攻擊者可能發送了一個需要分配非常大型陣列的小型有效載荷,這可能導致 OutOfMemoryException 拒絕服務。

適用於