I am assuming that it's going to be a job for linq, but I cannot figure out how to make it work?
My biggest problem is that I am working on a field within the table.
I assume the code should look like this (minus my hideous oversimplification of the aggregate function)
public void GetSomeTotals()
{
obervablecollection<dbtable> tabledata = await tablerepo.getitems();
int totalItems = tabledata.Aggregate(func: (result, item) => result += item);
}
pseudo code
public void GetSomeTotals()
{
obervablecollection<dbtable> tabledata = await tablerepo.getitems();
int totalitems;
tabledata. ??? ( x => totalItems += x.Quantity);
}
I cannot get the second example to work, because the int object is outside of the scope.