public static Money Sum<T>(this IEnumerable<T> data, Func<T, Money> selector)
{
var money = new Money(0);
money = data.Select(selector.Invoke).Aggregate(money, (current, selectedMoney) => current + selectedMoney);
return money;
}
No comments:
Post a Comment