问个关于HASHMAP的问题
C#中,HASHMAP的命名空间是什么?
2011-11-10 16:39
程序代码:using System.Collections.Generic;
using System;
namespace Test
{
class Test
{
static void Main()
{
// 第一个方法
Dictionary<string, string> map = new Dictionary<string, string>();
map["first"] = "one";
map["second"] = "two";
map["third"] = "three";
// 第二个方法
map = new Dictionary<string, string>
{
{"first", "one"},
{"second", "two"},
{"third", "three"}
};
foreach (var pair in map)
{
Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
}
Console.ReadLine();
}
}
}
2011-11-11 07:49