Esempio n. 1
0
            public ValueTask SubscribeAsync(IAsyncObserver <T> observer)
            {
                var obs = default(IAsyncObservable <T>);

                try
                {
                    obs = _factory();
                }
                catch (Exception error)
                {
                    obs = AsyncObservable.Throw <T>(error);
                }

                return(obs.SubscribeAsync(observer));
            }
Esempio n. 2
0
            public async ValueTask SubscribeAsync(IAsyncObserver <T> observer)
            {
                var obs = default(IAsyncObservable <T>);

                try
                {
                    obs = await _factory().ConfigureAwait(false);
                }
                catch (Exception error)
                {
                    obs = AsyncObservable.Throw <T>(error);
                }

                await obs.SubscribeAsync(observer).ConfigureAwait(false);
            }
Esempio n. 3
0
        public ValueTask SubscribeAsync(IAsyncObserver <TResult> observer)
        {
            IAsyncObservable <TResult> source;

            try
            {
                var resource = _resourceFactory();
                source = _observableFactory(resource).Finally(() => resource.Dispose());
            }
            catch (Exception ex)
            {
                source = AsyncObservable.Throw <TResult>(ex);
            }

            return(source.SubscribeAsync(observer));
        }