我想填充词典的词典字典。但是,当我尝试填充我的第三个词典时,我得到下面的错误。我如何填充我的第二个字典而不会出现错误?如何填充字典字典词典?
The best overloaded method match for 'System.Collections.Generic.Dictionary<string,System.Collections.Generic.Dictionary<string,
System.Collections.Generic.List<string>>>.this[string]' has some invalid arguments
//code
ClientsData.Add(new MapModel.ClientInfo { Id = IDCounter, Doctors = new Dictionary<string, Dictionary<string,List<string>>>() });
ClientsData[0].Doctors.Add(Reader["DocID"].ToString(), new Dictionary<string,List<string>>());
ClientsData[0].Doctors[0].Add("Name", new List<string>(){ Reader["DocName"].ToString()});//Error occurs here
我会扔了这一点还有:这是一个巨大的代码味道。我会说大设计问题。 –
你会更好地做一个自定义'结构ComplexKey',它执行必要的相等/散列代码魔术来充当* one *字典的关键字。 –