Class MaxOperator
Extension methods implementing the max operator.
public static class MaxOperator
- Inheritance
-
System.ObjectMaxOperator
Remarks
Built directly on the no-seed Reduce<T>(Observable<T>, Func<T, T, T>) overload,
matching rxjs's own max.ts (itself a thin wrapper over reduce). Since that overload emits nothing
for an empty source rather than erroring, so does Max<T>(Observable<T>) — matches rxjs exactly, verified
against the 7.8.2 tag rather than assumed.
Methods
Max<T>(Observable<T>)
Emits the single largest value seen from source, once it completes, using the default
Comparer<T> for T.
public static Observable<T> Max<T>(this Observable<T> source)
Parameters
sourceObservable<T>The source sequence.
Returns
- Observable<T>
An observable that emits the largest value seen, once
sourcecompletes.
Type Parameters
TThe type of values emitted by
sourceand of the output.
Remarks
If source completes without ever emitting, the output completes without emitting any value either.
Max<T>(Observable<T>, Func<T, T, int>)
Emits the single largest value seen from source (per comparer),
once it completes.
public static Observable<T> Max<T>(this Observable<T> source, Func<T, T, int> comparer)
Parameters
sourceObservable<T>The source sequence.
comparerFunc<T, T, int>A function returning a positive number if the first value is greater, matching Comparer<T>.Compare(T, T)'s contract.
Returns
- Observable<T>
An observable that emits the largest value seen, once
sourcecompletes.
Type Parameters
TThe type of values emitted by
sourceand of the output.
Remarks
If source completes without ever emitting, the output completes without emitting any
value either. If comparer throws, the exception is forwarded via OnError.