T
Tony Johansson
Hello!
I have this linq query below which works as expected but I have one
question.
If I just change the .Select operator to *.Select(eo => new {id = e.id,
optionsCount = eo.optionsCount}));*
Here as you can see I have taken the id from variable e which is employee
insted of eo will the result be the same ?
I'm almost sure it will but I just want to be 100 % sure.
Employee[] employees = Employee.GetEmployeesArray();
EmployeeOptionsEntry[] empOptions =
EmployeeOptionEntry.GetEmployeeOptionEntries();
var employeeOptions = employees
.SelectMany(e => empOptions
.Where(eo => eo.id == e.id)
.Select(eo => new {id = eo.id, optionsCount
= eo.optionsCount}));
foreach (var item in employeeOptions)
Console.WriteLine(item);
//Tony
I have this linq query below which works as expected but I have one
question.
If I just change the .Select operator to *.Select(eo => new {id = e.id,
optionsCount = eo.optionsCount}));*
Here as you can see I have taken the id from variable e which is employee
insted of eo will the result be the same ?
I'm almost sure it will but I just want to be 100 % sure.
Employee[] employees = Employee.GetEmployeesArray();
EmployeeOptionsEntry[] empOptions =
EmployeeOptionEntry.GetEmployeeOptionEntries();
var employeeOptions = employees
.SelectMany(e => empOptions
.Where(eo => eo.id == e.id)
.Select(eo => new {id = eo.id, optionsCount
= eo.optionsCount}));
foreach (var item in employeeOptions)
Console.WriteLine(item);
//Tony