I am from python programming and just a little knowledge of c#. I would like to group the following:
List<List<dynamic>> data = new List<List<dynamic>>();
data.Add(new List<dynamic> {"a", "z", "m", 4});
data.Add(new List<dynamic> {"b", "x", "n", 2});
data.Add(new List<dynamic> {"b", "x", "n", 1});
data.Add(new List<dynamic> {"c", "y", "n", 3});
data.Add(new List<dynamic> {"a", "z", "m", 5});
data.Add(new List<dynamic> {"a", "y", "m", 6});
How can I group the list of list above without using keys only by index? I want the output to be:
{
{"a", "z", "m", {4, 5}},
{"b", "x", "n", {2, 1}},
{"c", "y", "n", {3}},
{"a", "y", "m", {6}}
}
question from:
https://stackoverflow.com/questions/65897852/c-sharp-grouping-list-of-list-by-index 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…