ICollection(T).Add Method

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


Adds an item to an ICollection<T> object.

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

void ICollection<T>.Add(
	T item


Type: T

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

Exception Condition

The ICollection<T> is read-only.

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.

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Available since 4.0
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
© 2016 Microsoft