C# StringCollection Clear

Description

StringCollection Clear removes all the strings from the StringCollection.

Syntax

StringCollection.Clear has the following syntax.


public void Clear()

Returns

StringCollection.Clear method returns

Example


using System;//from w ww  .  j  av a2  s.  c  o  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"};
      myCol.AddRange( myArr );

      myCol.Clear();

      foreach ( Object obj in myCol )
         Console.WriteLine( "   {0}", obj );
      Console.WriteLine();
   }

}




















Home »
  C# Tutorial »
    System.Collections.Specialized »




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator