List<T>.IList.Add(Object) List<T>.IList.Add(Object) List<T>.IList.Add(Object) Method

定義

將項目加入至 IListAdds an item to the IList.

 virtual int System.Collections.IList.Add(System::Object ^ item) = System::Collections::IList::Add;
int IList.Add (object item);
Function Add (item As Object) As Integer Implements IList.Add

參數

item
Object Object Object

要加入至 ObjectIListThe Object to add to the IList.

傳回

插入新項目的位置。The position into which the new element was inserted.

實作

例外狀況

item 屬於無法指派給 IList 的類型。item is of a type that is not assignable to the IList.

備註

如果Count是小於Capacity,這個方法是 o (1) 作業。If Count is less than Capacity, this method is an O(1) operation. 如果容量需要增加,以容納新的項目,這個方法會變成 O (n) 運算,其中nCountIf the capacity needs to be increased to accommodate the new element, this method becomes an O(n) operation, where n is Count.

適用於