各位大哥
  在Hashtable中怎样怎样取得键的名字啊比如
  Hashtable hash=new Hashtable();
  hash.add(name,value);
  我再从hash表中取那个name要怎么才能得到呢??请指教

解决方案 »

  1.   

    IDictionaryEnumerator enumerator = resourceReader.GetEnumerator();
    while (enumerator.MoveNext())
    {
        object name = enumerator.Key;
        object value = enumerator.Value;
    }
      

  2.   

    Hashtable aa = new Hashtable();
    aa.Add("aaa","bbb");
    System.Collections.ICollection bb = aa.Keys;
    System.Collections.ArrayList cc = new ArrayList(bb);Response.Write(cc[0].ToString());
      

  3.   

    Hashtable aa = new Hashtable();
    aa.Add("aaa",1);
    aa.Add("bbb",2);其中aa(1),aa(2)就是1和2对应的名字
    Hashtable就是用来快速查找的,键值唯一