int[] studentIds = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };//学生 int[] schoolIds = new int[] { 1, 2 };//学校 for (int i = 0; i < studentIds.Length; i++) { Console.WriteLine("studentId:" + studentIds[i]); if (i <= schoolIds.Length - 1) { Console.WriteLine("schoolId:" + schoolIds[i]); } else { Console.WriteLine("schoolId:" + schoolIds[i % schoolIds.Length]); } }