这个简单:
1 List<Dictionary<char, int>> list = new List<Dictionary<char, int>>(); 2 Dictionary<char, int> dict = new Dictionary<char, int>(); 3 dict.Add('1', 1); 4 list.Add(dict);
Dictionary<char,int> dic = new Dictionary<char,int>();
dic.Add('a',1);
list.Add(dic);
先创建一个Dictionary 对象,将key 1,value 1 写入到Dictionary 在执行list add
List<Dictionary<char, int>> list = new List<Dictionary<char, int>>(); Dictionary<char, int> dic = new Dictionary<char, int>(); dic.Add('1', 1); list.Add(dic);