Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法创建具有另一个SortedList的SortedList_C#_Collections - Fatal编程技术网

C# 无法创建具有另一个SortedList的SortedList

C# 无法创建具有另一个SortedList的SortedList,c#,collections,C#,Collections,我犯了一个错误 无法从“System.Collections.Generic.SortedList”转换为“System.Collections.SortedList” 我很困惑…您忘记为内部分类列表指定类型参数,它发现了一个非泛型参数,它是另一种类型。这样做: months.Add(1, "January"); all.Add(2012,months); var all=new SortedList(); 您忘记为内部分类列表指定类型参数,它发现了一个非泛型参数,这是另一种类型。这样做: m

我犯了一个错误

无法从“System.Collections.Generic.SortedList”转换为“System.Collections.SortedList”


我很困惑…

您忘记为内部
分类列表指定类型参数,它发现了一个非泛型参数,它是另一种类型。这样做:

months.Add(1, "January");
all.Add(2012,months);
var all=new SortedList();

您忘记为内部
分类列表指定类型参数,它发现了一个非泛型参数,这是另一种类型。这样做:

months.Add(1, "January");
all.Add(2012,months);
var all=new SortedList();

您必须命名参数(否则它是另一种类型)。试试这个:

var all = new SortedList<int, SortedList<int, string>>();
SortedList all=新的SortedList();

您必须命名参数(否则它是另一种类型)。试试这个:

var all = new SortedList<int, SortedList<int, string>>();
SortedList all=新的SortedList();

谢谢Matti。。我还需要一个帮助..如何获取内部SortedList的参考..我想更新它…取决于提供的密钥…谢谢Matti。。我还需要一个帮助..如何获取内部SortedList的引用..我想更新它…取决于提供的密钥。。。