ArrayRecord.GetArray(Type, Boolean) 方法

定义

分配数组,并使用序列化记录中提供的数据(例如基元类型( String 如或 Int32)或序列化记录本身填充数组。

[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

如果允许 数组中的值,则为 ;否则为 < a1/ >。

返回

用序列化记录中提供的数据填充的数组。

属性

例外

expectedArrayType 与有效负载中的数据不匹配。

注解

在调用此方法之前,请使用 Lengths 属性检查数组的总长度。 攻击者可能发送了一个小有效负载,该有效负载需要分配非常大的数组,这可能会导致 OutOfMemoryException 和拒绝服务。

适用于