I'm trying to use an array of named tuples in a LINQ (LINQ-to-object) query like this:
(int from, int to)[] inputRanges = { (1,2), (3,4) };
var result = from range in inputRanges
select Enumerable.Range(range.from, range.to - range.from + 1);
return result.SelectMany(x => x);
However, I receive a compiler error, telling me that range
has no member from
and it instead expected a comma ,
instead of .from
.
What am I doing wrong? Are named tuples and LINQ-to-objects not combinable?