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 -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -