-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-Language DesignDiscussionLanguage-C#Resolution-Not ApplicableThe issue is not relevant to code in this repo and is not an external issue.The issue is not relevant to code in this repo and is not an external issue.
Description
LINQ extension methods that also return the Enumerator, so that the rest of the sequence can further processed. I think that the enumerator be required to be lifted into a capture so it lifetime can persist across multiple methods.
Example: OnFirst
Tuple<IEnumerator<T>,R> OnFirst<T,R>( this IEnumerable<T> xs , initial R, Func<R,T, R> fn )
{
var en = xs.GetEnumerator();
var res = initial;
if( en.MoveNext() )
{
res = fn(res, en.Current )
return Tuple.Create(res, en );
}
return res;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-Language DesignDiscussionLanguage-C#Resolution-Not ApplicableThe issue is not relevant to code in this repo and is not an external issue.The issue is not relevant to code in this repo and is not an external issue.