Remove the string at the specified index of the StringCollection in CSharp
Description
The following code shows how to remove the string at the specified index of the StringCollection.
Example
using System;/*from w ww . j a va2s . co m*/
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 );
myCol.RemoveAt( 1 );
foreach ( Object obj in myCol ){
Console.WriteLine( obj );
}
}
}
The code above generates the following result.