EDIT
Misread the question a bit. This code will give you consequetive elements
public static IEnumerable<Pair<T,T>> GroupIntoConsequetive(this IEnumerable<T> enumerable) {
using ( var e = enumerable.GetEnumerator() ) {
if ( !e.MoveNext() ) {
yield break;
}
var last = e.Current;
while ( e.MoveNext() ) {
yield return new Pair<T,T>(last, e.Current);
last = e.Current;
}
}
}
I'm not sure there is default way but writing an extension method to do so shouldn't be to difficult. I'm assuming there is a simple Pair implementation
public static IEnumerable<Pair<T,T>> Window(this IEnumerable<T> enumerable) {
using ( var e = enumerable.GetEnumerator() ) {
while ( e.MoveNext() ) {
var first = e.Current;
if ( !e.MoveNext() ) {
throw new InvalidOperationException("Need even number");
}
var second = e.Current;
yield return new Pair<T,T>(first,second);
}
}
}
With the window you could then get the behavior you desire with the following
var col = GetQueryableItem();
col.Window().Select(pair => method1(pair.First, pair.Second));
Quick and dirty Pair implementation
public struct Pair<T1,T2> {
public readonly T1 First;
public readonly T2 Second;
public Pair(T1 first, T2 second) {
First = first;
Second = second;
}
}