Mono Class Library: System.Array Overview | Members

System.Array.Clear Method

Sets the specified range of elements in the specified Array to zero, false, or to a null reference, depending on the element type. [Edit]

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
public static void Clear (Array array, int index, int length)

Parameters

array
The Array to clear. [Edit]
index
A int that contains the index at which clearing starts. [Edit]
length
A int that contains the number of elements to clear, beginning with index. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionarray is null. [Edit]
ArgumentOutOfRangeException

index < array.GetLowerBound(0).

length < 0.

index and length do not specify a valid range in array (i.e. index + length > array.GetLowerBound(0) + array.Length ).

[Edit]

Remarks

Reference-type elements will be set to null. Value-type elements will be set to zero, except for bool elements, which will be set to false. [Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0