62,074
社区成员
发帖
与我相关
我的任务
分享
Dictionary<string, string> openWith =
new Dictionary<string, string>();
int i=0;
if (openWith .Contains(i))
{
openWith [i] = i; //修改key为i的Value
}
else
{
openWith .Add(i, 0); //添加key为i的记录
}
Dictionary<string, string> openWith =
new Dictionary<string, string>();
int i=0;
if (openWith .Contains(i))
{
openWith [i] = i; //修改key为i的Value
}
else
{
openWith .Add(i, 0); //添加key为i的记录
}
Dictionary<string, string> openWith =
new Dictionary<string, string>();
openWith.Add("txt", "notepad.exe");
openWith.Add("bmp", "paint.exe");
openWith.Add("dib", "paint.exe");
openWith.Add("rtf", "wordpad.exe");
try
{
openWith.Add("txt", "winword.exe");
}
catch (ArgumentException)
{
Console.WriteLine("An element with Key = \"txt\" already exists.");
}
Console.WriteLine("\nRemove(\"doc\")");
openWith.Remove("doc");
if (!openWith.ContainsKey("doc"))
{
Console.WriteLine("Key \"doc\" is not found.");
}
Dictionary<int, string> d = new Dictionary<int, string>();
d.Add(1, "11");
d.Add(2, "22");
d.Remove(1);