【发布时间】:2014-10-16 10:27:38
【问题描述】:
这段代码运行良好
Dictionary<string, bool> test = new Dictionary<string, bool>();
test.Add("test string", true);
以下代码抛出此错误:无法将类型“void”隐式转换为“System.Collections.Generic.Dictionary”
Dictionary<string, bool> test = new Dictionary<string, bool>().Add("test string", true);
为什么?有什么区别?
【问题讨论】:
标签: c# generics dictionary