This documentation is archived and is not being maintained.

List.System.Collections.IList.Add Method

Adds an item to the IList.

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

Private Function System.Collections.IList.Add ( _
	item As Object _
) As Integer Implements IList.Add
Dim instance As List(Of T)
Dim item As Object
Dim returnValue As Integer

returnValue = CType(instance, IList).Add(item)
Not applicable.



The Object to add to the IList.

Return Value

The position into which the new element was inserted.

Exception typeCondition


item is of a type that is not assignable to the IList.

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0