using System;
using System.Collections.Generic;
using System.Linq;
/**烟台大学计算机学院学生
*All right reserved.
*文件名称:C#-—体验哈希表(Hashtable)
*作者:杨飞
*完成日期:2014年9月2日
*版本号:v1.0
*对任务及求解方法的描述部分:C#-—体验哈希表(Hashtable)
*我的程序:*/
using System.Text;
using System.Collections;
using System.Threading.Tasks;
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
Hashtable has = new Hashtable();
//添加键和值
has.Add("王上",1001);
has.Add("杨梦", 1002);
has.Add("周亲", 1003);
has.Add("adkna", 1004);
has.Add("奥斯卡", 1005);
has["王上"] = 88888;
has.Remove("杨梦");
foreach(DictionaryEntry item in has)
{
Console.WriteLine("{0},{1}",item.Key,item.Value);
}
Console.ReadKey();
}
}
}
运行结果:
心得体会:呵呵