无法转换Dictionary <string,dictionary <string,string>&gt;到IDictionary <string,idictionary <string,string>&gt; </string,idictionary <string,string> </string,dictionary <string,string>

时间:2013-06-25 05:18:56

标签: asp.net

IDictionary<string, IDictionary<string, string>> test = new Dictionary<string, Dictionary<string, string>>();

此转换是错误的,为什么不能隐式Dictionary<string,Dictionary<string,string>> to IDictionary<string,IDictionary<string,string>>?

1 个答案:

答案 0 :(得分:1)

查看此博客"Generic type parameter variance in the CLR",其中解释了为何不允许转化。