-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
4 - In ReviewA fix for the issue is submitted for review.A fix for the issue is submitted for review.Area-CompilersFeature - TuplesTuplesTuplesFeature Request
Milestone
Description
using System;
using System.Linq;
using System.Collections.Generic;
static class C
{
static IEnumerable<(T, U)> AsEnumerable<T, U>(
this (IEnumerable<T> xs, IEnumerable<U> ys) source)
=> source.xs.Zip(source.ys, (x, y) => (x, y));
static void Main()
{
foreach(var (x, y) in AsEnumerable((new int[1], new byte[2]))) // OK
{
}
foreach(var (x, y) in (new int[1], new byte[2]).AsEnumerable()) // ERROR; needs cast
{
}
}
}In fact, an extension GetEnumerator should be sufficient without the explicit call.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
4 - In ReviewA fix for the issue is submitted for review.A fix for the issue is submitted for review.Area-CompilersFeature - TuplesTuplesTuplesFeature Request