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

System.Collections.ArrayList.Remove Method

Removes the first occurrence of the specified object from the current instance.

public virtual void Remove (object obj)

Parameters

obj
The object to remove from the current instance.

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
As described above.

This method determines equality by calling object.Equals(object).

If obj is found in the current instance, obj is removed from the current instance, the rest of the elements are shifted down to fill the position vacated by obj, the ArrayList.Count of the current instance is decreased by one, and the position that was previously the last element in the current instance is set to null. If obj is not found in the current instance, the current instance remains unchanged.

Note: For the default implementation, this method performs a linear search. On average, this is an O(n/2) operation, where n is ArrayList.Count of the current instance. The longest search is an O(n) operation.

Requirements

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