using System;
using System.Collections.Generic;
namespace ConsoleApplication_C_Sharp
{
class Program
{
static void Main(string[] args)
{
try
{
Dictionary<string, int> dic = new Dictionary<string, int>();
dic.Add("c#", 100);
int value = dic["c++"];
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}
/*
run:
System.Collections.Generic.KeyNotFoundException: The given key was not present i
n the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at ConsoleApplication_C_Sharp.Program.Main(String[] args) in d:\Conso
leApplication_C_Sharp\ConsoleApplication_C_Sharp\Program.cs:line 16
*/