C# | Remove all the strings from the StringCollection
StringCollection class is a new addition to the .NET Framework class library that represents a collection of strings. StringCollection class is defined in the System.Collections.Specialized namespace.
StringCollection.Clear method is used to remove all the strings from the StringCollection.
public void Clear ();
- Count is set to zero, and references to other objects from elements of the collection are also released.
- This method is an O(n) operation, where n is Count.
StringCollection myCol =
String myArr =
"Initially elements in StringCollection are: "
"After Removing: "
Initially elements in StringCollection are: