¿Cómo crearía y luego accedería a una colección de un diccionario (ordenado)? Podría ser una Series<SortedDictionary<double, MyClass>> o un Dictionary<int, SortedDictionary<double, MyClass>> por ejemplo.
Series[0] = sortedDict; Dict.Add(myInt, sortedDict);Por alguna razón, al hacerlo así, el Diccionario está vacío, al acceder a los valores con un bucle y la serie parece estar vacía también.
for (int i = 0; i < Dict.Count; i++) { SortedDictionary<double, MyClass> sortedDictPair = Dict.ElementAt(i).Value; foreach (var item in sortedDictPair) { Print(item.Key); MyClass myClass= item.Value; Print(myClass.classMember); } } SortedDictionary<double, MyClass> sortedDictPair = Series[0]; for (int j = 0; j < sortedDictPair.Count; j++) { MyClass myClass = sortedDictPair.ElementAt(j).Value; Print(myClass.classMember); } }¿Hay algo que estoy supervisando? Editar: cuando dejo que imprima el sortedDict antes de asignarlo, está lleno de entradas.
¿Puedes probarlos en dos bucles foreach?
Dictionary<int, SortedDictionary<double, MyClass>> dictionary = new Dictionary<int, SortedDictionary<double, MyClass>>() { { 1, new SortedDictionary<double,MyClass>(){ {2, new MyClass{ Score=1 } }, { 3, new MyClass { Score = 1 } } } }, { 2, new SortedDictionary<double,MyClass>()} }; foreach (var item1 in dictionary) { foreach (var item2 in item1.Value) { Console.WriteLine(item2.Key); MyClass myClass = item2.Value; Console.WriteLine(myClass.Score); } }