Beispiel #1
0
        public static IAsyncObservable <TSource> Append <TSource>(this IAsyncObservable <TSource> source, IAsyncScheduler scheduler, params TSource[] values)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (scheduler == null)
            {
                throw new ArgumentNullException(nameof(scheduler));
            }
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }

            return(Create <TSource>(async observer =>
            {
                var d = new CompositeAsyncDisposable();

                var(sink, disposable) = AsyncObserver.Append(observer, scheduler, values);

                await d.AddAsync(disposable).ConfigureAwait(false);

                var subscription = await source.SubscribeSafeAsync(sink).ConfigureAwait(false);

                await d.AddAsync(subscription).ConfigureAwait(false);

                return d;
            }));
        }
Beispiel #2
0
        public static IAsyncObservable <TSource> Append <TSource>(this IAsyncObservable <TSource> source, TSource value)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

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