StringCollection::IList::Add Method (Object^)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Adds an object to the end of the StringCollection.

Namespace:   System.Collections.Specialized
Assembly:  System (in System.dll)

private:
virtual int Add(
	Object^ value
) sealed = IList::Add

Parameters

value
Type: System::Object^

The Object to be added to the end of the StringCollection. The value can be null.

Return Value

Type: System::Int32

The StringCollection index at which the value has been added.

Exception Condition
NotSupportedException

The StringCollection is read-only.

-or-

The StringCollection has a fixed size.

StringCollection accepts null as a valid value and allows duplicate elements.

If Count already equals the capacity, the capacity of the StringCollection is increased by automatically reallocating the internal array, and the existing elements are copied to the new array before the new element is added.

If Count is less than the 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.

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show: