×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Use the Let Keyword to Create Variables in a LINQ Query
 

Submitted by: Srinath M S(srinath_ms@yahoo.com)

Monday Oct 30th 2017 by Srinath M S

Language: .NET, Expertise: Intermediate - See how to use the Let keyword if you need to have variables inside a LINQ query to hold an evaluation result.

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();
Home
Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved