Let keyword when using LINQ

I found another cool feature in LINQ (yes another one). Basically LINQ introduces a new keyword, let.

This keyword lets you declare “variables” in your query that you can use throughout the query itself and even to project data out of the query… It would look something like this…

linq.jpg

and as expected the result would be

linqoutput.jpg

Quite cool….

Regards

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s