1

Topic: LINQ against extension methods

Whether there is a syntactic possibility to generate the variable code ' counter ' in "F" and thus to remain in syntax LINQ? static int? getValue (int i) {return i;}//the Initial variant static void F (int i) {var q = from counter in Enumerable. Range (1,10).Take (5) let result = getValue (i) where result. HasValue select result. Value;}//F through static void F2 extension methods (int i) {var q = Enumerable. Range (1, 10).Take (5).Select (counter => new {counter, result = getValue (i)}).Where (t => t.result. HasValue).Select (t => t.result. Value);}//Here there is no superfluous variable static void F3 (int i) {var q = Enumerable. Range (1, 10).Take (5).Select (_ => getValue (i)).Where (t => t. HasValue).Select (t => t. Value);}

2

Re: LINQ against extension methods

Hello, _NN _, you wrote: whether _NN> There is a syntactic possibility to generate the variable code ' counter ' in "F" and thus to remain in syntax LINQ? Now it is full of optimizers that replace linq with hand-written implementations at an assembly stage. For example: https://github.com/antiufo/roslyn-linq-rewrite

3

Re: LINQ against extension methods

Hello, _NN _, you wrote: whether _NN> There is a syntactic possibility to generate the variable code ' counter ' in "F" and thus to remain in syntax LINQ? from counter in Enumerable. Range (1,10).Take (5) select getValue (i) into result where result. HasValue select result. Value;