You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I was wondering if it would be possible to include Jon's SelectPairs()
extension from http://stackoverflow.com/a/619180/91551 ? Code below:
using System.Collections.Generic;
// This must be a non-nested type, and must be static to allow the extension
// method.
public static class Extensions
{
public static IEnumerable<TResult> SelectPairs<TSource, TResult>
(this IEnumerable<TSource> source,
Func<TSource, TSource, TResult> selector)
{
using (IEnumerator<TSource> iterator = source.GetEnumerator())
{
if (!iterator.MoveNext())
{
yield break;
}
TSource prev = iterator.Current;
while (iterator.MoveNext())
{
TSource current = iterator.Current;
yield return selector(prev, current);
prev = current;
}
}
}
}
Original issue reported on code.google.com by rdingw...@gmail.com on 12 Dec 2012 at 1:59
The text was updated successfully, but these errors were encountered:
It's already there and it's called Pairwise:
http://code.google.com/p/morelinq/source/browse/MoreLinq/Pairwise.cs?name=1.0.15
416-beta
If you are using the NuGet package, update to the pre-release:
http://nuget.org/packages/morelinq/1.0.15416-beta
Original comment by azizatif on 12 Dec 2012 at 5:58
Original issue reported on code.google.com by
rdingw...@gmail.com
on 12 Dec 2012 at 1:59The text was updated successfully, but these errors were encountered: