LINQ in the compiler
See original GitHub issueNot really a bug but:
And the method in the select:
That method is used to compile method arguments, the result is then enumerated twice (once in the first highlighted line, one is the last):
This causes all method arguments to be compiled twice due to multiple enumeration. I’m not aware of any bugs due to this behavior, but it probably negatively impacts compile time for complicated member invocations. Also the method supplied to Select is not done in such a way that the delegate can be cached per instance by roslyn.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
LinQ - C# - OneCompiler
Write, Run & Share C# code online using OneCompiler's C# online compiler for free. It's one of the robust, feature-rich online compilers for...
Read more >Language Integrated Query (LINQ) in C# | Microsoft Learn
Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# ...
Read more >c# - What is LINQ Actually Compiled To?
For LINQ to Objects, this is compiled into a set of static method calls: var productNames = from p in products where p.Id...
Read more >How is LINQ compiled?
LINQ itself isn't really compiled directly to IL. LINQ is just a wrapper around some regular .NET code. Anything you can write in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks @SeeminglyScience! I submitted the PR #13491 to fix this, please take a look if you have time.
🎉This issue was addressed in #13491, which has now been successfully released as
v7.1.0-preview.7.🎉Handy links: