Skip to content
Snippets Groups Projects
IEnumerableExtensions.cs 513 B
Newer Older
using System.Collections.Generic;
using System.Linq;

namespace Mapbox.Vector.Tile
{

    public static class EnumerableExtensions
    {
        public static IEnumerable<T> GetOdds<T>( this IEnumerable<T> sequence )
        {
            return sequence.Where( ( item, index ) => index % 2 != 0 );
        }

        public static IEnumerable<T> GetEvens<T>( this IEnumerable<T> sequence )
        {
            return sequence.Where( ( item, index ) => index % 2 == 0 );
        }
    }

}