Ejemplo n.º 1
0
        public static IAsyncObservable <TSource> First <TSource>(this IAsyncObservable <TSource> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(Create <TSource>(observer => source.SubscribeSafeAsync(AsyncObserver.First(observer))));
        }
Ejemplo n.º 2
0
        public static IAsyncObservable <TSource> First <TSource>(this IAsyncObservable <TSource> source, Func <TSource, ValueTask <bool> > predicate)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (predicate == null)
            {
                throw new ArgumentNullException(nameof(predicate));
            }

            return(Create <TSource>(observer => source.SubscribeSafeAsync(AsyncObserver.First(observer, predicate))));
        }