Add a string to the end of the StringCollection in CSharp

Description

The following code shows how to add a string to the end of the StringCollection.

Example


using System;/* www .j a  v  a2s .  c o  m*/
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringCollection  {

   public static void Main()  {
      StringCollection myCol = new StringCollection();

      myCol.Add( "A" );

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

}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary