我有一个 List<List<string>>信息;那是另外 3 个列表。我需要能够在这些子列表中的每一个上做三件不同的事情。我如何访问每个子列表?
为了更加清晰,列表已添加到主列表中,如下所示
infomration.Add(sublist1);//where each sublist is a List<string> and information is a <List<List<string>>
infomration.Add(sublist2);
infomration.Add(sublist3);
reutrn information;
请您参考如下方法:
您希望对列表中的 3 个元素(列表)执行 3 个独立的操作。既然 Lists 是有索引的,为什么不以这种方式访问它们呢?
PerformOperationOne(myListofLists[0]);
PerformOperationTwo(myListofLists[1]);
PerformOperationThree(myListofLists[2]);
