Support for named tuples
I've been thinking about whether it is possible to support named tuples in LINQPad. (I can always use anonymous types, but tuples are nicer syntax.)
Looking at the IL for the generated query dll of my code below, I see a TupleElementNames
on my delegate, which Extensions.Dump
can't see because it passes through Enumerable.Select
first. Is it possible for Dump
to look into the IL (or receive an expression tree..?) and follow a chain of ValueTuple
-returning methods until it discovers one with a TupleElementNamesAttribute
on it?
Comments
Named tuple seems not contained in runtime.
This is a fundamental problem with type erasure. I don't think it would be enough to look at the IL: it would need to go back to the Roslyn syntax tree and try to find the right spot. This is difficult to achieve and brittle at best, especially in non-trivial cases.