使用 for 循环遍历 List1。使用模运算符,您可以确保索引永远不会大于 List2 的计数。
for (int i = 0;i < List1.Count; i++)
{
Console.WriteLine("List1: " + List1[i]);
Console.WriteLine("List2: " + List2[i % List2.Count]);
}
Run Code Online (Sandbox Code Playgroud)
在线演示:https : //dotnetfiddle.net/oL834n