C# StringCollection AddRange

Description

StringCollection AddRange copies the elements of a string array to the end of the StringCollection.

Syntax

StringCollection.AddRange has the following syntax.


public void AddRange(
  string[] value
)

Parameters

StringCollection.AddRange has the following parameters.

  • value - An array of strings to add to the end of the StringCollection. The array itself can not be null but it can contain elements that are null.

Returns

StringCollection.AddRange method returns

Example


using System;//from  w  w  w . ja  v 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 );

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

}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator