Freigeben über


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

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Adds an item to an ICollection<T> object.

Namespace:  System.Collections.Generic
Assembly:  System.Core (in System.Core.dll)

Syntax

'Declaration
Private Sub Add ( _
    item As T _
) Implements ICollection(Of T).Add
void ICollection<T>.Add(
    T item
)

Parameters

Implements

ICollection<T>.Add(T)

Exceptions

Exception Condition
NotSupportedException

The ICollection<T> is read-only.

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.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.