ArrayList.Adapter(IList) Method

Definition

Creates an ArrayList wrapper for a specific IList.

public:
 static System::Collections::ArrayList ^ Adapter(System::Collections::IList ^ list);
public static System.Collections.ArrayList Adapter (System.Collections.IList list);
static member Adapter : System.Collections.IList -> System.Collections.ArrayList
Public Shared Function Adapter (list As IList) As ArrayList

Parameters

list
IList

The IList to wrap.

Returns

The ArrayList wrapper around the IList.

Exceptions

list is null.

Remarks

Adapter does not copy the contents of IList. Instead, it only creates an ArrayList wrapper around IList; therefore, changes to the IList also affect the ArrayList.

The ArrayList class provides generic Reverse, BinarySearch and Sort methods. This wrapper can be a means to use those methods on IList; however, performing these generic operations through the wrapper might be less efficient than operations applied directly on the IList.

This method is an O(1) operation.

Applies to

See also