c# - How do you use collection initializers to create a new dictionary? -


if can in list

list<int> = new list<int>() {    2, 4, 6, 8, 10 }; 

how can same thing in dictionary?

dictionary<int, bool> b = new dictionary<int, bool>() {    ?, ?, ? }; 

dictionary<int, bool> b = new dictionary<int, bool>() {    {1, true},{2, false},{3, true} }; 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

javascript - Preserving URL fragment through CAS sign-on -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -