public static IEnumerable<T> Pipe<T>(this IEnumerable<T> source, Action<T> action)
{
return _(); IEnumerable <T> _()
{
foreach (var element in source)
{
action(element);
yield return element;
}
}
}
I've found this code in MoreLinq repo and can't understand this line:
return _(); IEnumerable <T> _()
I am the maintainer of MoreLINQ. Below, I am quoting from a pull request that will give you the background behind the use of local functions:
To answer on the choice of the style
return _(); IEnumerable <T> _()
, I'm going to quote the rationale I provided in pull request #360 to the project: