Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: .NET
Expertise: Intermediate
Oct 30, 2017

Use the Let Keyword to Create Variables in a LINQ Query

There are cases in which you will find the need to have variables inside a LINQ query to hold an evaluation result. The Let keyword helps in this case. See below for an example:

var oldTeens = from kidAge in kidsAges
               let age = kidAge  14
               where age
               select kidAge;

var result = oldTeens.ToList();
Srinath M S
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date