Computes the sum of a view of nullable Int32 values.
Namespace:
C1.LiveLinqAssembly: C1.Silverlight.LiveLinq (in C1.Silverlight.LiveLinq.dll)
Syntax
C# |
---|
public static AggregationView<Nullable<int>, Nullable<int>> LiveSum( this View<Nullable<int>> source ) |
Visual Basic |
---|
<ExtensionAttribute> _ Public Shared Function LiveSum ( _ source As View(Of Nullable(Of Integer)) _ ) As AggregationView(Of Nullable(Of Integer), Nullable(Of Integer)) |
Parameters
- source
- Type: C1.LiveLinq.LiveViews..::..View<(Of <(<'Nullable<(Of <(<'Int32>)>)>>)>)>
A view containing the values to calculate the sum of.
Return Value
A view representing the sum of the values.Remarks
If the source is empty or contains only nulls, the sum value is zero.
It is possible to use standard LINQ query operator Sum instead of LiveSum. Both are "live" in the sense that they are recomputed automatically when any change occurs in the source. The difference is that Sum will every time loop through the entire source collection and aggregate it from scratch, whereas LiveSum will use a more performant algorithm, will maintain its value incrementally, processing only those source items that actually changed.