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

定義

將項目加入 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);
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> 物件的物件。The object to add to the ICollection<T> object.

實作

例外狀況

ICollection<T> 為唯讀。The ICollection<T> is read-only.

備註

這個成員是明確介面成員實作,This member is an explicit interface member implementation. 只有在 SortedSet<T> 執行個體轉換成 ICollection<T> 介面時,才能使用這個成員。It can be used only when the SortedSet<T> instance is cast to an ICollection<T> interface.

如果 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.

適用於