ArrayList.Adapter(IList) 方法


建立特定 ArrayListIList 包裝函式。Creates an ArrayList wrapper for a specific IList.

 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



要包裝的 IListThe IList to wrap.


包住 ArrayListIList 包裝函式。The ArrayList wrapper around the IList.


listnulllist is null.


Adapter 不會複製 IList的內容。Adapter does not copy the contents of IList. 相反地,它只會建立 IListArrayList 包裝函式;因此,對 IList 所做的變更也會影響 ArrayListInstead, it only creates an ArrayList wrapper around IList; therefore, changes to the IList also affect the ArrayList.

ArrayList 類別提供泛型 ReverseBinarySearchSort 方法。The ArrayList class provides generic Reverse, BinarySearch and Sort methods. 此包裝函式可以是在 IList上使用這些方法的方式;不過,透過包裝函式執行這些一般作業,可能會比直接在 IList上套用的作業更有效率。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.

這個方法是 O(1) 作業。This method is an O(1) operation.

版本相容性Version Compatibility

在 .NET Framework 版本1.0 和1.1 中,在 ArrayList 包裝函式上呼叫 GetEnumerator(Int32, Int32) 方法多載傳回的列舉值會將第二個引數視為上限,而不是計數。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.NET Framework 2.0 會將第二個引數正確地視為計數。In the .NET Framework 2.0.NET Framework 2.0 the second argument is correctly treated as a count.