This post will discuss how to iterate from the second element of a List in C#.

The foreach statement provides a simple, clean way to iterate through the elements of a sequence. The idea is to use the Enumerable.Skip method to skip the first element in a list.

The following example demonstrates the usage of a foreach statement to iterate from the second element of a list. The code can be easily modified to skip the desired number of items from the beginning of a sequence.

Download  Run Code

Output:

2
3
4
5

 
To print the specified number of items from the start of a sequence, consider using the Enumerable.Take method.

Download  Run Code

Output:

1
2
3

 
Alternatively, you can use the traditional for-loop to iterate over a list starting from the second index. Here’s what the code would look like:

Download  Run Code

Output:

2
3
4
5

That’s all about iterating from the second element of a List in C#.