コード例 #1
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
        public static async Task ForEachAsync <T>(this IAsyncFastEnumerable <T> source, Func <T, Task> next)
        {
            var e = source.GetAsyncEnumerator();

            try
            {
                while (await e.WaitForNextAsync().ConfigureAwait(false))
                {
                    while (true)
                    {
                        var item = e.TryGetNext(out var success);

                        if (!success)
                        {
                            break;
                        }

                        await next(item).ConfigureAwait(false);
                    }
                }
            }
            finally
            {
                await e.DisposeAsync().ConfigureAwait(false);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
        public static async Task <R> Aggregate <T, R>(this IAsyncFastEnumerable <T> source, R seed, Func <R, T, Task <R> > aggregate)
        {
            var res = seed;

            var e = source.GetAsyncEnumerator();

            try
            {
                while (await e.WaitForNextAsync().ConfigureAwait(false))
                {
                    while (true)
                    {
                        var item = e.TryGetNext(out var success);

                        if (!success)
                        {
                            break;
                        }

                        res = await aggregate(res, item).ConfigureAwait(false);
                    }
                }
            }
            finally
            {
                await e.DisposeAsync().ConfigureAwait(false);
            }

            return(res);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
 public WhereFastIteratorWithTask(IAsyncFastEnumerable <T> source, Func <T, Task <bool> > predicate)
 {
     _source    = source;
     _predicate = predicate;
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
 public WhereFastIterator(IAsyncFastEnumerable <T> source, Func <T, bool> predicate)
 {
     _source    = source;
     _predicate = predicate;
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
 public SelectFastIteratorWithTask(IAsyncFastEnumerable <T> source, Func <T, Task <R> > selector)
 {
     _source   = source;
     _selector = selector;
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
 public SelectFastIterator(IAsyncFastEnumerable <T> source, Func <T, R> selector)
 {
     _source   = source;
     _selector = selector;
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
 public AsyncFastEnumerableToAsyncEnumerable(IAsyncFastEnumerable <T> source)
 {
     _source = source;
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
 public static IAsyncFastEnumerable <T> Where <T>(this IAsyncFastEnumerable <T> source, Func <T, Task <bool> > predicate) => new WhereFastIteratorWithTask <T>(source, predicate);
コード例 #9
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
 public static IAsyncEnumerable <T> ToAsyncEnumerable <T>(this IAsyncFastEnumerable <T> source) => new AsyncFastEnumerableToAsyncEnumerable <T>(source);
コード例 #10
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
 public static IAsyncFastEnumerable <R> Select <T, R>(this IAsyncFastEnumerable <T> source, Func <T, Task <R> > selector) => new SelectFastIteratorWithTask <T, R>(source, selector);