Returns all the elements but the first - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IEnumerable

Description

Returns all the elements but the first

Demo Code


using System.Linq;
using System.Collections.Generic;

public class Main{
        /// <summary>
        /// Returns all the elements but the first
        /// </summary>
        /// <typeparam name="T">Type of the collection</typeparam>
        /// <param name="sequence">Collection to use</param>
        /// <returns>result = collection@pre->at( 1, length - 1)</returns>
        public static IEnumerable<T> Tail<T>(this IEnumerable<T> sequence)
        {//from  w w  w  .  j  av a  2s  . co  m
            return sequence.Skip(1);
        }
}

Related Tutorials