System.Collections.ArrayList.Clear Method

Removes all elements from the ArrayList.

Syntax

public virtual void Clear ()

Exceptions

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

Remarks

ArrayList.Count is set to zero, and references to other objects from elements of the collection are also released.

ArrayList.Capacity remains unchanged. To reset the capacity of the ArrayList, call ArrayList.TrimToSize or set the ArrayList.Capacity property directly. Trimming an empty ArrayList sets the capacity of the ArrayList to the default capacity.

This method is an O(n) operation, where n is ArrayList.Count.

Requirements

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