List<int> list = new List<int> { 0, 4, 6, 8, 9, 11, 14 }; for (int index = 0; index < list.Count - 1; index++) { Console.WriteLine($"{list[index]}, {list[index + 1]}"); } }
for (int i = 0; i < list.Count; ++i) { if (i == list.Count - 1) // the last item break; // list[i] and list[i + 1] are the next two items }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)