C# StringCollection Insert
Description
StringCollection Insert
inserts a string into the StringCollection
at the specified index.
Syntax
StringCollection.Insert
has the following syntax.
public void Insert(
int index,
string value
)
Parameters
StringCollection.Insert
has the following parameters.
index
- The zero-based index at which value is inserted.value
- The string to insert. The value can be null.
Returns
StringCollection.Insert
method returns
Example
using System;//from w w w . j av a 2s .c o m
using System.Collections;
using System.Collections.Specialized;
public class SamplesStringCollection {
public static void Main() {
StringCollection myCol = new StringCollection();
myCol.Insert( 0, "A " );
foreach ( Object obj in myCol )
Console.WriteLine( " {0}", obj );
Console.WriteLine();
}
}
The code above generates the following result.