0 out of 1 rated this helpful - Rate this topic

ArrayList.Adapter Method

Creates an ArrayList wrapper for a specific IList.

Namespace:  System.Collections
Assembly:  mscorlib (in mscorlib.dll)
public static ArrayList Adapter(
	IList list
)

Parameters

list
Type: System.Collections.IList

The IList to wrap.

Return Value

Type: System.Collections.ArrayList
The ArrayList wrapper around the IList.
ExceptionCondition
ArgumentNullException

list is null.

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.

Version Compatibility

In the .NET Framework version 1.0 and 1.1, calling the GetEnumerator(Int32, Int32) method overload on the ArrayList wrapper returned an enumerator that treated the second argument as an upper bound rather than as a count. In the .NET Framework 2.0 the second argument is correctly treated as a count.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.