Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone done the Linq 101 samples with Lambda syntax?

Tags:

lambda

linq

Has anyone done the job of translating the 101 Linq samples published by Microsoft to Lambda syntax?

If no, does anyone know a site to use as starting point for learning Linq Lambda syntax? I liked the format of the 101 Linq samples, so something similar would be appreciated.

like image 931
Nilzor Avatar asked Dec 02 '11 15:12

Nilzor


People also ask

What is LINQ and lambda expressions?

The term 'Lambda expression' has derived its name from 'lambda' calculus which in turn is a mathematical notation applied for defining functions. Lambda expressions as a LINQ equation's executable part translate logic in a way at run time so it can pass on to the data source conveniently.

How do you write LINQ?

There are the following two ways to write LINQ queries using the Standard Query operators, in other words Select, From, Where, Orderby, Join, Groupby and many more. Using lambda expressions. Using SQL like query expressions.

Which of the following can serve as a data source for a LINQ query in C #?

Types such as ArrayList that support the non-generic IEnumerable interface can also be used as a LINQ data source.


2 Answers

I finally got around to do this job myself :-) All 101 samples are now converted to Lambda/Fluent syntax and published at Linq101.nilzorblog.com

like image 64
Nilzor Avatar answered Oct 26 '22 05:10

Nilzor


If you want to learn lambda syntax, download LinqPad. Then write the normal syntax Eg:

from f in Features
where f.Id > 0
select f

Then run it, and at the bottom you'll see "Results lambda SQL IL" Simply click on the Lambda, and you'll see:

Features.Where(f => (f.Id > 0))

It doesn't always produce the cleanest syntax, but it is a way to learn the lambda syntax.

like image 22
taylonr Avatar answered Oct 26 '22 04:10

taylonr