DataSource for Entity Framework in WPF
C1.LiveLinq Namespace / LiveViewExtensions Class / LiveAverage Method / LiveAverage(View<Double>) Method
A view containing the values to calculate the average of.

In This Topic
    LiveAverage(View<Double>) Method
    In This Topic
    Computes the average of a view of System.Double values.
    Public Overloads Shared Function LiveAverage( _
       ByVal source As View(Of Double) _
    ) As AggregationView(Of Double,Double)
    public static AggregationView<double,double> LiveAverage( 
       View<double> source


    A view containing the values to calculate the average of.

    Return Value

    A view representing the average of the values.

    If the source is empty or contains only nulls, an System.InvalidOperationException is thrown.

    It is possible to use standard LINQ query operator Average instead of LiveAverage. Both are "live" in the sense that they are recomputed automatically when any change occurs in the source. The difference is that Average will every time loop through the entire source collection and aggregate it from scratch, whereas LiveAverage will use a more performant algorithm, will maintain its value incrementally, processing only those source items that actually changed.

    See Also