HashSet<T>.ICollection<T>.Add(T) 方法

定義

將項目加入 ICollection<T> 物件。

 virtual void System.Collections.Generic.ICollection<T>.Add(T item) = System::Collections::Generic::ICollection<T>::Add;
void ICollection<T>.Add (T item);
abstract member System.Collections.Generic.ICollection<T>.Add : 'T -> unit
override this.System.Collections.Generic.ICollection<T>.Add : 'T -> unit
Sub Add (item As T) Implements ICollection(Of T).Add

參數

item
T

要加入 ICollection<T> 物件的物件。

實作

例外狀況

備註

如果 Count 小於 Capacity ,則這個方法是 O (1) 作業。 如果容量必須增加以容納新元素,這個方法會變成 O (n) 作業,其中 nCount

適用於