DRAG DROP
You have a class named Customer and a class named Order.
The customer class has a property named Orders that contains a list of Order objects.
The Order class has a property named OrderDate that contains the date of the Order.
You need to create a LINQ query that returns all of the customers who had at least one order during the year2005.
You write the following code.
How should you complete the code? To answer, drag the appropriate code elements to the correct targets in
the answer area. Each code element may be used once, more than once, or not at all. You may need to drag
the split bar between panes or scroll to view content.
Select and Place:
Where
Any
=>
==
Agree with you.
Agree with wer(Where, Any, => ==)
correct answer is
Where
Any
=>
==
// Return all customer who had at least one order during year 2005
List customersWithOrder2015 =
customers.Where(p=>p.Orders.Any(q=> q.OrderDate.Year ==2005))
.ToList();
Where
Any
=>
==