Export (0) Print
Expand All

HashSet(Of T).Add Method

Adds the specified element to a set.

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

'Declaration
Public Function Add ( _
	item As T _
) As Boolean

Parameters

item
Type: T
The element to add to the set.

Return Value

Type: System.Boolean
true if the element is added to the HashSet(Of T) object; false if the element is already present.

Implements

ISet(Of T).Add(T)

If Count already equals the capacity of the HashSet(Of T) object, the capacity is automatically adjusted to accommodate the new item.

If Count is less than the capacity of the internal array, this method is an O(1) operation. If the HashSet(Of T) object must be resized, this method becomes an O(n) operation, where n is Count.

Silverlight

Supported in: 5, 4

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

Community Additions

ADD
Show:
© 2014 Microsoft