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
- How to implement is functionality without using is keyword in C#
- C# | this Keyword
- LINQ | Filtering Operator | OfType
- C# | finally keyword
- C# | as Operator Keyword
- C# | is Operator Keyword
- Is vs As operator keyword in C#
- Static keyword in C#
- typeof Operator Keyword in C#
- LINQ | Method Syntax
- Invoking an overloaded constructor using this keyword in C#
- Difference between readonly and const keyword in C#
- LINQ | Join (Inner Join)
- LINQ (Language Integrated Query)
- LINQ | Set Operator | Except
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.