C# StringDictionary StringDictionary

Description

StringDictionary StringDictionary initializes a new instance of the StringDictionary class.

Syntax

StringDictionary.StringDictionary has the following syntax.


public StringDictionary()

Example


using System;/*from  w ww. jav  a2s. c o  m*/
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringDictionary  {
   public static void Main()  {
      StringDictionary myCol = new StringDictionary();
      myCol.Add( "red", "rojo" );
      myCol.Add( "green", "verde" );
      myCol.Add( "blue", "azul" );

      String[] myKeys = new String[myCol.Count];
      myCol.Keys.CopyTo( myKeys, 0 );

      for ( int i = 0; i < myCol.Count; i++ )
         Console.WriteLine( "   {0,-5} {1,-25} {2}", i, myKeys[i], myCol[myKeys[i]] );
   }

}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator