Редагувати

Поділитися через


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

Definition

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

Parameters

item
T

The object to add to the ICollection<T> object.

Implements

Exceptions

Remarks

If Count is less than Capacity, this method is an O(1) operation. If the capacity must be increased to accommodate the new element, this method becomes an O(n) operation, where n is Count.

Applies to