Skip to content

Commit

Permalink
Use simple foreach loop in Iterleave's yielding loop
Browse files Browse the repository at this point in the history
  • Loading branch information
atifaziz committed Nov 22, 2019
1 parent d883a75 commit 9fc8486
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions MoreLinq/Interleave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ static IEnumerable<T> Interleave<T>(this IEnumerable<T> sequence, ImbalancedInte
if (shouldContinue) // only if all iterators could be advanced
{
// yield the values of each iterator's current position
for (var index = 0; index < iterCount; index++)
{
yield return iteratorList[index].Current;
}
foreach (var iterator in iteratorList)
yield return iterator.Current;
}
}
}
Expand Down

0 comments on commit 9fc8486

Please sign in to comment.