我建了一个哈希表foreach (System.Collections.DictionaryEntry j in dapei)
{
int f = 0;
//string word= Console.WriteLine(j.Key.ToString());
//int a= Console.WriteLine(j.Value);
Console.WriteLine(j.Key.ToString());
Console.WriteLine(j.Value);
//int ciyu.Count;
f++;
}
请高手指点下,怎么讲key和Value分别赋值给string word和int a
value里面都是数字
{
int f = 0;
//string word= Console.WriteLine(j.Key.ToString());
//int a= Console.WriteLine(j.Value);
Console.WriteLine(j.Key.ToString());
Console.WriteLine(j.Value);
//int ciyu.Count;
f++;
}
请高手指点下,怎么讲key和Value分别赋值给string word和int a
value里面都是数字
Console.WriteLine(j.Value);
这两句能否打印出来?
如果能的话就这样:
String wrod=j.Key.ToString();
int a= Convert.ToInt32(Value);
Hashtable ht=new Hashtable(); 创建一个Hashtable实例
ht.Add(E,e);添加keyvalue键值对
ht.Add(A,a);
ht.Add(C,c);
ht.Add(B,b);这样就OK了