Supposing I have two classes, Customer and Order, where one Customer can have one-or-many Orders associated to it.
class Customer
{
Order[] Orders;
}
class Order
{
int OrderId;
}
If for any given Customer, I want to find all the associated OrderId's, is there an easy way to do that using linq ? Something that gives the same result as the following foreach solution:
List<int> allOrderIds = new List<int>();
foreach (Order thisOrder in thisCustomer)
{
allOrderIds.Add(thisOrder.OrderId);
}
TIA.