Esempio n. 1
0
        public static IAsyncOptionEnumerable <TResult> Select <TSuccess, TResult>(this IAsyncOptionEnumerable <TSuccess> source, Func <TSuccess, Task <TResult> > selector)
        {
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            return(source
                   .SelectAsync(result => result
                                .MatchAsync(
                                    success => Option.SomeAsync(selector.Invoke(success)),
                                    () => Task.FromResult(Option.None <TResult>())
                                    )
                                )
                   .AsAsyncOptionEnumerable());
        }