I have inherited a LINQ project.
I am trying to do the equivalent of "select max(empid) from employees" using LINQ.
My statement is var mx = (from EmpID in db.EmployeeMains select EmpID).Max(); and it barfs at the max() part.
EmployeeMains is a table with column EmpID as an int.
I could work around but I would like to know how to use aggregates in linq.
I am trying to do the equivalent of "select max(empid) from employees" using LINQ.
My statement is var mx = (from EmpID in db.EmployeeMains select EmpID).Max(); and it barfs at the max() part.
EmployeeMains is a table with column EmpID as an int.
I could work around but I would like to know how to use aggregates in linq.