Each Linq expression must have a
select
.
from ... in ... select ...;
Your example data is incomplete or maybe wrong. You talk about
List<data>
but this is nowhere visible in your code.
Your
LstAll
seems to be a list (you call
Add(...)
in the loop), but initialization is by a single element (
new Employee()
is not likely to be a list, right?).
Please revise your question and carefully check the code in the question so it exactly matches what you have in your homework assignment.
Cheers
Andi
PS: What does
DeleteData(...)
doing? If it removes some item from the list it loops over, the program is broken.
PPS: If the problem is to add a range of elements to a list, then use the
AddRange(...)
method.
PPPS: Is this a typo or don't you understand where to use/don't use type names (see
Employee):
LstAll.AddRange(from o in Data let c = DeleteData(o,Employee e) ... select ...);
or is it rather the following?
LstAll.AddRange(from o in Data let c = DeleteData(o, new Employee()) ... select ...);