How does ordered dictionary work with integer keys ?

Does ordered dictionary only need to have string variables as keys or can It have any type of keys ?

 Console.WriteLine("Hello World!"); OrderedDictionary d2 = new OrderedDictionary(); d2.Add(1, 114); d2.Add(2, 223); d2.Add(3, 335); Console.WriteLine(d2[0]); // gives 114 as output Console.WriteLine(d2[1]); // gives 223 as output Console.WriteLine(d2[3]); // gives error 

so, if we have integer keys , we can’t use ordered dictionaries . Am I right ?

submitted by /u/scaredofrealworld
[link] [comments]

Leave a Reply