I just want to know what's the lambda expression of Select * from TableName
.
Like in plain LINQ it will be var res=from s in db.StudentDatas select s
;
here StudentData
is name of the table.
Thanks.
select (s => new SelectListItem { Value = s. ID. ToString(), Text = s.Name} ); select (s => new SelectListItem { Value = s.ID + "", Text = s.Name} );
A lambda expression is a short block of code which takes in parameters and returns a value. Lambda expressions are similar to methods, but they do not need a name and they can be implemented right in the body of a method.
The lambda expression isn't needed:
var res = db.StudentDatas;
You could use one but it would be rather pointless:
var res = db.StudentDatas.Select(s => s);
The compiler will translate it to something along these lines:
db.StudentDatas.Select(s => s)
The translation to SQL is done by the Base Class Library. SQL, of course, does not use lambda expressions...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With