C# StringCollection Add

Description

StringCollection Add adds a string to the end of the StringCollection.

Syntax

StringCollection.Add has the following syntax.


public int Add(
  string value
)

Parameters

StringCollection.Add has the following parameters.

  • value - The string to add to the end of the StringCollection. The value can be null.

Returns

StringCollection.Add method returns The zero-based index at which the new element is inserted.

Example


using System;// w ww  . jav a2 s  .c  om
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( "   {0}", obj );
   }

}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator