<PackageReference Include="System.Reactive" Version="5.0.0-preview.220" />

ObservableEx

public static class ObservableEx
Provides a set of static methods for writing in-memory queries over observable sequences.
using System.Collections.Generic; using System.Reactive.Concurrency; using System.Runtime.CompilerServices; namespace System.Reactive.Linq { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public static class ObservableEx { private static IQueryLanguageEx s_impl = QueryServices.GetQueryImpl((IQueryLanguageEx)new QueryLanguageEx()); [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] public static IObservable<(TFirst First, TSecond Second)> CombineLatest<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond>(this IObservable<TFirst> first, IObservable<TSecond> second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return s_impl.CombineLatest(first, second); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third)> CombineLatest<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); return s_impl.CombineLatest(first, second, third); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth)> CombineLatest<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); return s_impl.CombineLatest(first, second, third, fourth); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth)> CombineLatest<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth, [System.Runtime.CompilerServices.Nullable(2)] TFifth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); if (fifth == null) throw new ArgumentNullException("fifth"); return s_impl.CombineLatest(first, second, third, fourth, fifth); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth)> CombineLatest<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth, [System.Runtime.CompilerServices.Nullable(2)] TFifth, [System.Runtime.CompilerServices.Nullable(2)] TSixth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth, IObservable<TSixth> sixth) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); if (fifth == null) throw new ArgumentNullException("fifth"); if (sixth == null) throw new ArgumentNullException("sixth"); return s_impl.CombineLatest(first, second, third, fourth, fifth, sixth); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh)> CombineLatest<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth, [System.Runtime.CompilerServices.Nullable(2)] TFifth, [System.Runtime.CompilerServices.Nullable(2)] TSixth, [System.Runtime.CompilerServices.Nullable(2)] TSeventh>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth, IObservable<TSixth> sixth, IObservable<TSeventh> seventh) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); if (fifth == null) throw new ArgumentNullException("fifth"); if (sixth == null) throw new ArgumentNullException("sixth"); if (seventh == null) throw new ArgumentNullException("seventh"); return s_impl.CombineLatest(first, second, third, fourth, fifth, sixth, seventh); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth)> CombineLatest<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth, [System.Runtime.CompilerServices.Nullable(2)] TFifth, [System.Runtime.CompilerServices.Nullable(2)] TSixth, [System.Runtime.CompilerServices.Nullable(2)] TSeventh, [System.Runtime.CompilerServices.Nullable(2)] TEighth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth, IObservable<TSixth> sixth, IObservable<TSeventh> seventh, IObservable<TEighth> eighth) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); if (fifth == null) throw new ArgumentNullException("fifth"); if (sixth == null) throw new ArgumentNullException("sixth"); if (seventh == null) throw new ArgumentNullException("seventh"); if (eighth == null) throw new ArgumentNullException("eighth"); return s_impl.CombineLatest(first, second, third, fourth, fifth, sixth, seventh, eighth); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] public static IObservable<(TFirst First, TSecond Second)> WithLatestFrom<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond>(this IObservable<TFirst> first, IObservable<TSecond> second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return s_impl.WithLatestFrom(first, second); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] public static IObservable<(TFirst First, TSecond Second)> Zip<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond>(this IObservable<TFirst> first, IEnumerable<TSecond> second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return s_impl.Zip(first, second); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] public static IObservable<(TFirst First, TSecond Second)> Zip<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond>(this IObservable<TFirst> first, IObservable<TSecond> second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return s_impl.Zip(first, second); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third)> Zip<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); return s_impl.Zip(first, second, third); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth)> Zip<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); return s_impl.Zip(first, second, third, fourth); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth)> Zip<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth, [System.Runtime.CompilerServices.Nullable(2)] TFifth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); if (fifth == null) throw new ArgumentNullException("fifth"); return s_impl.Zip(first, second, third, fourth, fifth); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth)> Zip<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth, [System.Runtime.CompilerServices.Nullable(2)] TFifth, [System.Runtime.CompilerServices.Nullable(2)] TSixth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth, IObservable<TSixth> sixth) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); if (fifth == null) throw new ArgumentNullException("fifth"); if (sixth == null) throw new ArgumentNullException("sixth"); return s_impl.Zip(first, second, third, fourth, fifth, sixth); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1, 1, 1, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh)> Zip<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth, [System.Runtime.CompilerServices.Nullable(2)] TFifth, [System.Runtime.CompilerServices.Nullable(2)] TSixth, [System.Runtime.CompilerServices.Nullable(2)] TSeventh>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth, IObservable<TSixth> sixth, IObservable<TSeventh> seventh) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); if (fifth == null) throw new ArgumentNullException("fifth"); if (sixth == null) throw new ArgumentNullException("sixth"); if (seventh == null) throw new ArgumentNullException("seventh"); return s_impl.Zip(first, second, third, fourth, fifth, sixth, seventh); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1 })] public static IObservable<(TFirst First, TSecond Second, TThird Third, TFourth Fourth, TFifth Fifth, TSixth Sixth, TSeventh Seventh, TEighth Eighth)> Zip<[System.Runtime.CompilerServices.Nullable(2)] TFirst, [System.Runtime.CompilerServices.Nullable(2)] TSecond, [System.Runtime.CompilerServices.Nullable(2)] TThird, [System.Runtime.CompilerServices.Nullable(2)] TFourth, [System.Runtime.CompilerServices.Nullable(2)] TFifth, [System.Runtime.CompilerServices.Nullable(2)] TSixth, [System.Runtime.CompilerServices.Nullable(2)] TSeventh, [System.Runtime.CompilerServices.Nullable(2)] TEighth>(this IObservable<TFirst> first, IObservable<TSecond> second, IObservable<TThird> third, IObservable<TFourth> fourth, IObservable<TFifth> fifth, IObservable<TSixth> sixth, IObservable<TSeventh> seventh, IObservable<TEighth> eighth) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (third == null) throw new ArgumentNullException("third"); if (fourth == null) throw new ArgumentNullException("fourth"); if (fifth == null) throw new ArgumentNullException("fifth"); if (sixth == null) throw new ArgumentNullException("sixth"); if (seventh == null) throw new ArgumentNullException("seventh"); if (eighth == null) throw new ArgumentNullException("eighth"); return s_impl.Zip(first, second, third, fourth, fifth, sixth, seventh, eighth); } [Experimental] public static IObservable<TResult> Create<[System.Runtime.CompilerServices.Nullable(2)] TResult>(Func<IObserver<TResult>, IEnumerable<IObservable<object>>> iteratorMethod) { if (iteratorMethod == null) throw new ArgumentNullException("iteratorMethod"); return s_impl.Create(iteratorMethod); } [Experimental] public static IObservable<Unit> Create(Func<IEnumerable<IObservable<object>>> iteratorMethod) { if (iteratorMethod == null) throw new ArgumentNullException("iteratorMethod"); return s_impl.Create(iteratorMethod); } [Experimental] public static IObservable<TSource> Expand<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, Func<TSource, IObservable<TSource>> selector, IScheduler scheduler) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); if (scheduler == null) throw new ArgumentNullException("scheduler"); return s_impl.Expand(source, selector, scheduler); } [Experimental] public static IObservable<TSource> Expand<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source, Func<TSource, IObservable<TSource>> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return s_impl.Expand(source, selector); } [Experimental] public static IObservable<TResult> ForkJoin<[System.Runtime.CompilerServices.Nullable(2)] TSource1, [System.Runtime.CompilerServices.Nullable(2)] TSource2, [System.Runtime.CompilerServices.Nullable(2)] TResult>(this IObservable<TSource1> first, IObservable<TSource2> second, Func<TSource1, TSource2, TResult> resultSelector) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); return s_impl.ForkJoin(first, second, resultSelector); } [Experimental] public static IObservable<TSource[]> ForkJoin<[System.Runtime.CompilerServices.Nullable(2)] TSource>(params IObservable<TSource>[] sources) { if (sources == null) throw new ArgumentNullException("sources"); return s_impl.ForkJoin(sources); } [Experimental] public static IObservable<TSource[]> ForkJoin<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IEnumerable<IObservable<TSource>> sources) { if (sources == null) throw new ArgumentNullException("sources"); return s_impl.ForkJoin(sources); } [Experimental] public static IObservable<TResult> Let<[System.Runtime.CompilerServices.Nullable(2)] TSource, [System.Runtime.CompilerServices.Nullable(2)] TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return s_impl.Let(source, selector); } [Experimental] public static IObservable<TResult> ManySelect<[System.Runtime.CompilerServices.Nullable(2)] TSource, [System.Runtime.CompilerServices.Nullable(2)] TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, TResult> selector, IScheduler scheduler) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); if (scheduler == null) throw new ArgumentNullException("scheduler"); return s_impl.ManySelect(source, selector, scheduler); } [Experimental] public static IObservable<TResult> ManySelect<[System.Runtime.CompilerServices.Nullable(2)] TSource, [System.Runtime.CompilerServices.Nullable(2)] TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, TResult> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return s_impl.ManySelect(source, selector); } [Experimental] public static ListObservable<TSource> ToListObservable<[System.Runtime.CompilerServices.Nullable(2)] TSource>(this IObservable<TSource> source) { if (source == null) throw new ArgumentNullException("source"); return s_impl.ToListObservable(source); } } }