CSharp - LINQ Skip


Skip operator skips a specified number of elements from the input sequence starting from start and yields the rest.


public static IEnumerable<T> Skip<T>(
        this IEnumerable<T> source,
        int count);

Skip operator is passed with an input source sequence and a count that specifies how many input elements should be skipped.

It returns an object that, when enumerated, will skip the first count elements and yield all subsequent elements.

If the value of count is greater than the number of elements in the input sequence, the input sequence will not be enumerated, and the output sequence will be empty.


ArgumentNullException is thrown if the input source sequence is null.


using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
class Program/*from   w  w w  . ja  v a  2 s  . co  m*/
    static void Main(string[] args)
        string[] codeNames = {"Python", "Java", "Javascript", "Bash", "C++", "Oracle"};
        IEnumerable<string> items = codeNames.Skip(1);
        foreach (string item in items)



The code above skips the first element.