Mono Class Library: System.Collections.ArrayList Overview | Members

System.Collections.ArrayList.Clear Method

Sets the elements in the current instance to zero, false, or null, depending upon the element type.

public virtual void Clear ()

Exceptions

TypeReason
NotSupportedExceptionThe current instance is read-only or has a fixed size.

Remarks

Note: This method is implemented to support the IList interface.

Operation
Reference-type elements are set to null. Value-type elements are set to zero, except for bool elements, which are set to false.

This method uses Array.Clear(Array, int, int) to reset the values of the current instance. ArrayList.Count is set to zero. ArrayList.Capacity is not changed.

Usage
To reset the ArrayList.Capacity of the current instance, call ArrayList.TrimToSize or set the ArrayList.Capacity property directly.

Requirements

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