C# StringCollection Remove
Description
StringCollection Remove
removes the first occurrence
of a specific string from the StringCollection.
Syntax
StringCollection.Remove
has the following syntax.
public void Remove(
string value
)
Parameters
StringCollection.Remove
has the following parameters.
value
- The string to remove from the StringCollection. The value can be null.
Returns
StringCollection.Remove
method returns
Example
using System;/* w w w. j av a2 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" };
myCol.AddRange( myArr );
myCol.Remove( "A" );
foreach ( Object obj in myCol )
Console.WriteLine( " {0}", obj );
Console.WriteLine();
}
}
The code above generates the following result.