I am NOOB so please forgive is silly question. I have searched multiple websites for answers but could not find specific answer. This is the code I am trying to do:
I am trying to figure out how to initialize a dictionary with a key and list. Using vs2015 up to date. When I put it in, VS does not highlight any thing is wrong, when I run debug am getting key not found error.
Any ideas as to what I am doing wrong would be appreciated.
Thanks in advance
Dictionary<int, List<int>> dictionary2 = new Dictionary<int, List<int>>() { [1] = { 1, 2, 3, 4 } }; foreach (var key in dictionary2.Keys) Console.WriteLine(key); Console.ReadKey(); //Pause
I am trying to figure out how to initialize a dictionary with a key and list. Using vs2015 up to date. When I put it in, VS does not highlight any thing is wrong, when I run debug am getting key not found error.
Any ideas as to what I am doing wrong would be appreciated.
Thanks in advance