如果你可以在List中执行此操作
List<int> a = new List<int>() {
2, 4, 6, 8, 10
};
Run Code Online (Sandbox Code Playgroud)
你怎么能在字典里做同样的事情?
Dictionary<int, bool> b = new Dictionary<int, bool>() {
?, ?, ?
};
Run Code Online (Sandbox Code Playgroud)
Dictionary<int, bool> b = new Dictionary<int, bool>() {
{1, true},{2, false},{3, true}
};
Run Code Online (Sandbox Code Playgroud)