我不能完全试图解决这个问题,但我将解释如下,
var combinedCoords = new List<List<int>>();
var coords = new List<List<int>>
{
new List<int>() {0, 1},
new List<int>() {0, 1, 2},
new List<int>() {1, 3, 4, 5},
new List<int>() {3, 4},
new List<int>() {7, 8},
new List<int>() {7, 8, 9},
new List<int>() {8, 9, 10}
};
Run Code Online (Sandbox Code Playgroud)
在这里,我有coords包含一些的var List<int>; 我需要的是在combinedCoords其中填充一些新列表,其中包含一些共同数字的组合列表.从这里应该有2个组合列表,第一个将是{0,1,2,3,4,5},第二个将是{7,8,9,10}.为了进一步说明我想说的是,下面是一个图形表示,每个圆圈都是一个列表; 括号中的红色数字表示每个列表的索引.