[]
        
(Showing Draft Content)

C1.LiveLinq.LiveViewExtensions.LiveCount

LiveCount Method

LiveCount<T>(View<T>)

A view representing the number of elements in a view.

Declaration
public static AggregationView<T, int> LiveCount<T>(this View<T> source)
Parameters
Type Name Description
View<T> source

A view that contains elements to be counted.

Returns
Type Description
AggregationView<T, int>
Type Parameters
Name Description
T

The type of the elements of source.

Remarks

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

LiveCount<T>(View<T>, Expression<Func<T, bool>>)

A view representing the number of elements of the specified view satisfying a condition.

Declaration
public static AggregationView<T, int> LiveCount<T>(this View<T> source, Expression<Func<T, bool>> predicate)
Parameters
Type Name Description
View<T> source

A view that contains elements to be tested and counted.

Expression<Func<T, bool>> predicate

A function to test each element for a condition.

Returns
Type Description
AggregationView<T, int>
Type Parameters
Name Description
T

The type of the elements of source.

Remarks

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