日期:2014-05-17 浏览次数:21299 次
static void Main(string[] args)
{
Hashtable htname = new Hashtable();
Hashtable _date = new Hashtable();
for (int i = 0; i < 5; i++)
{
_date.Add(i.ToString(),"0");
}
htname.Add("一号锅炉",_date);
htname.Add("二号锅炉",_date);
for (int i = 0; i < 5; i++)
{
string name = "一号锅炉";
string ele = (2 + 2).ToString();
Hashtable date = new Hashtable();
date = htname[name] as Hashtable;
date[2.ToString()] = ele;
htname[name] = date;
}
foreach (DictionaryEntry item in htname["一号锅炉"] as Hashtable)
{
Console.WriteLine(item.Key.ToString() + "," + item.Value.ToString());
}
foreach (DictionaryEntry item in htname["二号锅炉"] as Hashtable)
{
Console.WriteLine(item.Key.ToString() + "," + item.Value.ToString());
}
Console.Read();
}