▲ | kkukshtel 3 days ago | |||||||
Modern C# collection expressions make the definition of names closer to F#:
I know working on "natural type" of collections is something the C# team is working on, so it feels possible in the future that you'll be able to do this:
Which I think would then allow:
| ||||||||
▲ | pjc50 3 days ago | parent [-] | |||||||
I did try that initially and got
.. which I took to mean that, because .Select is an extension method on IEnumerable, the engine was unable to infer whether the collection should be a list, array, or some other type of collection.It seems reasonable to have it default to Array if it's ambiguous, maybe there's a downside I'm not aware of. | ||||||||
|