StringCollection.Add Method (String)


Adds a string to the end of the StringCollection.

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

member Add : 
        value:string -> int


Type: System.String

The string to add to the end of the StringCollection. The value can be null.

Return Value

Type: System.Int32

The zero-based index at which the new element is inserted.

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

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.

The following code example adds new elements to the StringCollection.

No code example is currently available or this language may not be supported.

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