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.

[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.
index
A int that contains the index at which clearing starts.
length
A int that contains the number of elements to clear, beginning with index.

Exceptions

TypeReason
ArgumentNullExceptionarray is null.
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 ).

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.

Requirements

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