ArrayList.Adapter(IList) 方法

定義

建立特定 IListArrayList 包裝函式。

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

要包裝的 IList

傳回

包住 IListArrayList 包裝函式。

例外狀況

listnull

備註

Adapter 不會複製 的內容 IList 。 相反地,它只會在 周圍建立 ArrayList 包裝函式,因此對 的變更 IList 也會影響 ArrayListIList

類別 ArrayList 提供泛型 ReverseBinarySearchSort 方法。 這個包裝函式可以是在 上使用 IList 這些方法的方法;不過,透過包裝函式執行這些泛型作業可能比直接套用在 IList 上的作業更有效率。

這個方法是 O(1) 作業。

版本相容性

在 .NET Framework 1.0 和 1.1 版中,呼叫 GetEnumerator(Int32, Int32) 包裝函式上的 ArrayList 方法多載會傳回將第二個引數視為上限而非計數的列舉值。 在 .NET Framework 2.0 中,第二個引數會正確視為計數。

適用於

另請參閱