List<T>.IList.Add(Object) 方法

定义

将项添加到 IList 中。Adds 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

要添加到 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.

适用于