wforney / morelinq

Automatically exported from code.google.com/p/morelinq
Apache License 2.0
0 stars 0 forks source link

TakeRangeEvery method #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
TakeEvery is great for taking just one item at regular intervals, but it 
would also be useful to take a range of items at regular intervals.

TakeRangeEvery(this IEnumerable<T> items, int rangeCount, int step)

Original issue reported on code.google.com by jeffma...@gmail.com on 11 Mar 2009 at 4:22

GoogleCodeExporter commented 9 years ago
This could also be an override of TakeEvery that takes the extra count 
parameter 
rather than being a totally new method.

Original comment by jeffma...@gmail.com on 17 Mar 2009 at 3:28

GoogleCodeExporter commented 9 years ago

Original comment by azizatif on 4 Apr 2009 at 6:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This is possible today using this 

http://msdn.microsoft.com/en-us/library/bb549418.aspx

public static IEnumerable<TSource> Where<TSource>(
    this IEnumerable<TSource> source,
    Func<TSource, int, bool> predicate
)

Like this:

var OneEveryTenth = coll.Where((item,i)=>(i%10)==0);
var TwoEveryTenth = coll.Where((item,i)=>(i%10)<2);

Original comment by tormod.s...@gmail.com on 16 Jun 2012 at 1:05