Thanks for your response. However, this is not really what I am looking for. I need to perform a weighted average in terms of the aggregation itself. Not as a post-step calculation. I also need to select the item by which to weigh it.
As an example, this could be achieved in SQL like so:
(item * weightItem) /
In C# it could be implemented as an extension method. E.g.:
IEnumerable<T> source, Func<T,
> itemSelector, Func<T,
var result = source.Aggregate(Tuple.Create(0.0, 0.0), (a, t) => Tuple.Create(a.Item1 + (itemSelector(t) * weightSelector(t)), a.Item2 + weightSelector(t)));
result.Item1 / result.Item2;
Is there any way to somehow plug in this custom aggregation?
Also worth pointing out, I'm using a QueryableDataProvider even though the data I'm working against is an IEnumerable (I'm simply performing an AsQueryable). The LocalDataSourceProvider did not perform very well when I first tried it (it loads everything into memory).