[]
Applies an accumulator function over a view.
public static AggregationView<TSource, TSource> LiveAggregate<TSource>(this View<TSource> source, Expression<Func<TSource, TSource, TSource>> funcAdd, Expression<Func<TSource, TSource, TSource>> funcRemove, Expression<Func<TSource, TSource, bool>> funcRemoveDefined)
Type | Name | Description |
---|---|---|
View<TSource> | source | A view to aggregate over. |
Expression<Func<TSource, TSource, TSource>> | funcAdd | An accumulator function to be invoked on each element that is added to the source view. |
Expression<Func<TSource, TSource, TSource>> | funcRemove | A function to be applied to the accumulated value and to an element to obtain the changed accumulated value, when an element is removed from the source view. |
Expression<Func<TSource, TSource, bool>> | funcRemoveDefined | A function used to determine whether funcRemove must be applied when an element is removed from the source view, or the accumulated value is not affected by its removal. |
Type | Description |
---|---|
AggregationView<TSource, TSource> | A view representing the final accumulator value. |
Name | Description |
---|---|
TSource | The type of the elements of source. |
It is possible to use standard LINQ query operator Aggregate instead of LiveAggregate. Both are "live" in the sense that they are recomputed automatically when any change occurs in the source. The difference is that Aggregate will every time loop through the entire source collection and aggregate it from scratch, whereas LiveAggregate will use a more performant algorithm, will maintain its value incrementally, processing only those source items that actually changed.
Applies an accumulator function over a view. The specified seed value is used as the initial accumulator value.
public static AggregationView<TSource, TAccumulate> LiveAggregate<TSource, TAccumulate>(this View<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> funcAdd, Expression<Func<TAccumulate, TSource, TAccumulate>> funcRemove, Expression<Func<TAccumulate, TSource, bool>> funcRemoveDefined)
Type | Name | Description |
---|---|---|
View<TSource> | source | A view to aggregate over. |
TAccumulate | seed | The initial accumulator value. |
Expression<Func<TAccumulate, TSource, TAccumulate>> | funcAdd | An accumulator function to be invoked on each element that is added to the source view. |
Expression<Func<TAccumulate, TSource, TAccumulate>> | funcRemove | A function to be applied to the accumulated value and to an element to obtain the changed accumulated value, when an element is removed from the source view. |
Expression<Func<TAccumulate, TSource, bool>> | funcRemoveDefined | A function used to determine whether funcRemove must be applied when an element is removed from the source view, or the accumulated value is not affected by its removal. |
Type | Description |
---|---|
AggregationView<TSource, TAccumulate> | A view representing the final accumulator value. |
Name | Description |
---|---|
TSource | The type of the elements of source. |
TAccumulate | The type of the accumulator value. |
It is possible to use standard LINQ query operator Aggregate instead of LiveAggregate. Both are "live" in the sense that they are recomputed automatically when any change occurs in the source. The difference is that Aggregate will every time loop through the entire source collection and aggregate it from scratch, whereas LiveAggregate will use a more performant algorithm, will maintain its value incrementally, processing only those source items that actually changed.
Applies an accumulator function over a view. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
public static AggregationView<TSource, TResult> LiveAggregate<TSource, TAccumulate, TResult>(this View<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> funcAdd, Expression<Func<TAccumulate, TSource, TAccumulate>> funcRemove, Expression<Func<TAccumulate, TSource, bool>> funcRemoveDefined, Expression<Func<TAccumulate, TResult>> resultSelector)
Type | Name | Description |
---|---|---|
View<TSource> | source | A view to aggregate over. |
TAccumulate | seed | The initial accumulator value. |
Expression<Func<TAccumulate, TSource, TAccumulate>> | funcAdd | An accumulator function to be invoked on each element that is added to the source view. |
Expression<Func<TAccumulate, TSource, TAccumulate>> | funcRemove | A function to be applied to the accumulated value and to an element to obtain the changed accumulated value, when an element is removed from the source view. |
Expression<Func<TAccumulate, TSource, bool>> | funcRemoveDefined | A function used to determine whether funcRemove must be applied when an element is removed from the source view, or the accumulated value is not affected by its removal. |
Expression<Func<TAccumulate, TResult>> | resultSelector | A function to transform the final accumulator value into the result value. |
Type | Description |
---|---|
AggregationView<TSource, TResult> | A view representing the final accumulator value. |
Name | Description |
---|---|
TSource | The type of the elements of source. |
TAccumulate | The type of the accumulator value. |
TResult | The type of the resulting value. |
It is possible to use standard LINQ query operator Aggregate instead of LiveAggregate. Both are "live" in the sense that they are recomputed automatically when any change occurs in the source. The difference is that Aggregate will every time loop through the entire source collection and aggregate it from scratch, whereas LiveAggregate will use a more performant algorithm, will maintain its value incrementally, processing only those source items that actually changed.