While exploring LINQ keywords, I encountered the Let keyword and thought to write something for .Net geeks. I've taken an idea from my previous article on http://www.c-sharpcorner.com about DefaultIfEmpty() and utilized similar code. You can look at this article here: http://www.c-sharpcorner.com/UploadFile/97fc7a/linq-method-defaultifempty/.
The Let keyword gives you the liberty to use its value for the next level. This is the beauty of this keyword, that you can utilize the value on the next statement, which helps you keep your code simpler and easier to understand.
Example for the LINQ Let Clause Using C# in ASP.Net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LINQ_LetKeyword
{
class Employee
{
public string Name { get; set; }
public string EmpID { get; set; }
public int Salary { get; set; }
}
class Program
{
static void Main(string[] args)
{
//Object Initialization for Employee class
List<Employee> objEmployee = new List<Employee>{


Satish BPosted Sep 3, 2018, 12:10 AM
This is the beauty of Let keyword
Abhineet SrivastavaPosted Jan 7, 2014, 1:21 AM
Good One :)
shreeniwas kushwahPosted Aug 22, 2012, 7:16 AM
Nice thing.....thats good