本文介绍了(HashTable)根据哈希表中的键获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我制作哈希表或添加一些键和值
就像那样
Hashtable Htbl = new Hashtable();
Htbl。添加(C100,思域);
Htbl.Add(C200,Carolla);
Htbl.Add(C300,BMW );
Htbl.Add(C400,Aulto);
现在我想根据用户给出的价值它的关键是通过console.readline()
简称(根据哈希表中的键获取值)
plz帮我
i make a hashtable or add some key and value
just like that
Hashtable Htbl = new Hashtable();
Htbl.Add("C100", "Civic");
Htbl.Add("C200", "Carolla");
Htbl.Add("C300", "BMW");
Htbl.Add("C400", "Aulto");
now i want to get value according to user give its key through console.readline()
in short(get value according to his key in hashtable)
plz help me
推荐答案
Console.WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]);
Hashtable Htbl = new Hashtable();
Htbl.Add("C100", "Civic");
Htbl.Add("C200", "Carolla");
Htbl.Add("C300", "BMW");
Htbl.Add("C400", "Aulto");
int n = 1;
string test = Htbl [n].ToString();
Console.Writeline(test);
现在迭代循环以获取所有值...
或者请参阅 []
这篇关于(HashTable)根据哈希表中的键获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!