Hi,
I would like to know how to add records manually to an existing Linq query
The testComp below returns 4 records after the 1st statement is executed, it then executes the next statement, but when I tried testComp.List().Count, it still returns 4 records. So, nothing is added. Is there anything missing from the code?
var testComp = (from p in dc.EmployeeVarComps
where (p.EmployeeID == curEmpID)
select new { p.EmployeeID });
testComp.ToList().Add(new { EmployeeID = empID });
Also, in debug mode, I run the following in the debug window
testComp.ToList().Add(new { EmployeeID = empID });
And I got this message: Expression cannot contain anonymous types
This error doesn't pop up but only when I run in the debug window.
Please advice. Thanks in advance.
- Edited by wkpli Thursday, June 18, 2015 3:22 PM