Пример #1
0
        static async Task SubjectAsync()
        {
            var subject = new SequentialSimpleAsyncSubject <int>();

            var res = subject.Where(x => x % 2 == 0).Select(x => x + 1);

            await res.SubscribeAsync(Print <int>());

            for (var i = 0; i < 10; i++)
            {
                await subject.OnNextAsync(i);
            }

            await subject.OnCompletedAsync();
        }
Пример #2
0
        static async Task MergeAsync()
        {
            var subject = new SequentialSimpleAsyncSubject <IAsyncObservable <int> >();

            var res = subject.Merge();

            await res.SubscribeAsync(Print <int>());

            for (var i = 1; i <= 10; i++)
            {
                await subject.OnNextAsync(AsyncObservable.Range(0, i));
            }

            await subject.OnCompletedAsync();
        }