Get or set the element at the specified index for StringCollection in CSharp
Description
The following code shows how to get or set the element at the specified index for StringCollection.
Example
using System;/*w w w. ja v a 2 s.c om*/
using System.Collections;
using System.Collections.Specialized;
public class SamplesStringCollection {
public static void Main() {
StringCollection myCol = new StringCollection();
String[] myArr = new String[] { "A", "B", "C", "java2s.com"};
myCol.AddRange( myArr );
Console.WriteLine( myCol[1]);
}
}
The code above generates the following result.