HashSet<T>.ICollection<T>.Add(T) HashSet<T>.ICollection<T>.Add(T) HashSet<T>.ICollection<T>.Add(T) Method

定义

ICollection<T> 对象添加一个项。Adds an item to an ICollection<T> object.

 virtual void System.Collections.Generic.ICollection<T>.Add(T item) = System::Collections::Generic::ICollection<T>::Add;
void ICollection<T>.Add (T item);
Sub Add (item As T) Implements ICollection(Of T).Add

参数

item
T T T

要添加到 ICollection<T> 对象中的对象。The object to add to the ICollection<T> object.

实现

异常

注解

Count 如果Capacity小于,则此方法为 O (1)操作。If Count is less than Capacity, this method is an O(1) operation. 如果必须增加容量以容纳新元素,则此方法将成为 O (n)运算,其中nCountIf the capacity must be increased to accommodate the new element, this method becomes an O(n) operation, where n is Count.

适用于