Linq to objects

Posts   
 
    
hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 08-Mar-2012 15:11:03   

I have an entity collection

EntityCollection<OrderEntity> myOrders

of orders entities. Each entity has a property .OrderValue

why can't I get the sum of all orders by using linq i.e

double orderSum = myOrders.Sum(o => o.OrderValue);

or can I?

Thanks in advance

hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 08-Mar-2012 16:38:47   

Ignore that - I forgot to add in using System.Linq;