Why is this code printing the same 'key' once only?
Dictionary<int,string> dictionary = new Dictionary<int,string>();
var keys=new List<string>();
try
{
dictionary.Add(5, "javed");
dictionary.Add(5, "khan");
dictionary.Add(5, "javed");
}
catch (ArgumentException)
{
Console.WriteLine("Key/Value pair already used");
}
finally
{
foreach (int key in dictionary.Keys)
{
Console.WriteLine(key);
}
}