ArrayList.Adapter(IList) 方法

定义

为特定 IList 创建 ArrayList 包装。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

参数

list
IList

要包装的 IListThe IList to wrap.

返回

ArrayList

IListArrayList 包装。The ArrayList wrapper around the IList.

例外

listnulllist is null.

注解

Adapter 不会复制的内容 IListAdapter does not copy the contents of IList. 相反,它只会创建一个 ArrayList 包装, IList 因此对的更改 IList 也会影响 ArrayListInstead, it only creates an ArrayList wrapper around IList; therefore, changes to the IList also affect the ArrayList.

ArrayList类提供泛型 Reverse BinarySearchSort 方法。The ArrayList class provides generic Reverse, BinarySearch and Sort methods. 此包装可能是在上使用这些方法的方法 IList ; 但是,通过包装执行这些泛型操作可能不如直接在上应用的操作有效 IListThis 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.

此方法是一种 O(1) 操作。This method is an O(1) operation.

版本兼容性Version Compatibility

在 .NET Framework 版本1.0 和1.1 中, GetEnumerator(Int32, Int32) 对包装器调用方法重载 ArrayList 返回一个枚举器,该枚举器将第二个参数视为上限而不是计数。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. 在 .NET Framework 2.0 中,第二个参数被正确视为计数。In the .NET Framework 2.0 the second argument is correctly treated as a count.

适用于

另请参阅