If you can do this in List
List<int> a = new List<int>() {
2, 4, 6, 8, 10
};
how can you do the same thing in Dictionary?
Dictionary<int, bool> b = new Dictionary<int, bool>() {
?, ?, ?
};
If you can do this in List
List<int> a = new List<int>() {
2, 4, 6, 8, 10
};
how can you do the 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}
};
MSDN has an article on this: http://msdn.microsoft.com/en-us/library/bb531208.aspx
You just wrap each key-value pair in curly brackets.