How to convert LINQ query to Lambda automatically

5.8k views Asked by At

I am curious to know how to convert LINQ query to lambda so I visited the below link and follow the same but my linq query could not convert to lamda automatically.

convert this LINQ expression into Lambda enter image description here

This is my LINQ pad image where I use C# program:

enter image description here

Can anyone guide me what I am doing for which linq pad not being able to convert my linq to lambda?

2

There are 2 answers

1
Mou On BEST ANSWER

i found out how to do it. here is the screen shot.

Writing the Query expression directly without .ToList(), .FirstOrDefault(), SingleOrDefault() will show the coresponding Lambda Expression in Lambda ExpressionTab.

enter image description here

1
Gerino On

You're not in "C# Expression" mode. Copy and paste just the LINQ part (from x in y...) to a new tab (make sure C# Expression is selected from the droplist) and then try converting to lambda. Repeat for other LINQ query.