Sometimes when we are working with a query expression, we require a variable that can store the result of the sub-expression in order to reuse it in the upcoming clause. This type of facility is provided by the Let keyword. The Let keyword allows you to create a range variable and initialized with the result of the query expression and then you are allowed to use that variable with the upcoming clause in the same query. When you initialize a range variable with one value after that you are not allowed to store another value in the range variable.
Explanation: In the above example, the result is the query variable which stores the result of the given query expression. In the query expression, we created a range variable using let keyword, i.e, a1. In a1, we store the result of the s + 100 expressions. After that we use this variable in where clause to compare each element is greater than 150 or not and last we print those elements which are greater than 150.
Employee Name: rohit Employee Name: supriya
- LINQ | Filtering Operator | OfType
- LINQ | Method Syntax
- LINQ | Join (Inner Join)
- LINQ (Language Integrated Query)
- LINQ | Set Operator | Except
- LINQ | Query Syntax
- LINQ | How to find the sum of the given Sequence?
- LINQ | How to find average of the given sequence?
- LINQ | How to find minimum value of the given sequence?
- LINQ | How to find maximum value of the given sequence?
- LINQ | Element Operator | Last
- What is Query in LINQ?
- Count the number of element present in the sequence in LINQ?
- LINQ | Projection Operator | Select
- LINQ | Projection Operator | SelectMany
- LINQ | Filtering Operator | where
- LINQ | Sorting Operator | OrderBy
- LINQ | Sorting Operator | OrderByDescending
- LINQ | Sorting Operator | Reverse
- LINQ | Sorting Operator | ThenBy
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.