stl有hash_map,用法如下:
map<string, string> namemap;
namemap["岳不群"]="华山派掌门人,人称君子剑";
namemap["张三丰"]="武当掌门人,太极拳创始人";
namemap["东方不败"]="第一高手,葵花宝典";
在c#中没有找到类似的类,还请高手赐教

解决方案 »

  1.   

    找到了Hashtable   顶者有分~~~~~~~~~~~~using System;
    using System.Collections;
    public class SamplesHashtable  {   public static void Main()  {      // Creates and initializes a new Hashtable.
          Hashtable myHT = new Hashtable();
          myHT.Add("First", "Hello");
          myHT.Add("Second", "World");
          myHT.Add("Third", "!");      // Displays the properties and values of the Hashtable.
          Console.WriteLine( "myHT" );
          Console.WriteLine( "  Count:    {0}", myHT.Count );
          Console.WriteLine( "  Keys and Values:" );
          PrintKeysAndValues( myHT );
       }
       public static void PrintKeysAndValues( Hashtable myList )  {
          IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
          Console.WriteLine( "\t-KEY-\t-VALUE-" );
          while ( myEnumerator.MoveNext() )
             Console.WriteLine("\t{0}:\t{1}", myEnumerator.Key, myEnumerator.Value);
          Console.WriteLine();
       }
    }
    /* 
    This code produces the following output.myHT
      Count:    3
      Keys and Values:
        -KEY-    -VALUE-
        Third:    !
        Second:    World
        First:    Hello
    */
      

  2.   

    Dictionary是它的替代品,Java中是有Map抽象类,HasMap,HasLinkMap等是可生成类
      

  3.   

    C#2.0的话,用Dictionary<string,string>……