コード例 #1
0
        /// <summary>Record Constructor</summary>
        /// <param name="question">The question to get the result from</param>
        /// <param name="selector">The function to apply of the question result.</param>
        public SelectManyQuestion(IQuestion <TSource> question, Func <TSource, IQuestion <TResult> > selector)
        {
            if (question == null)
            {
                throw new ArgumentNullException(nameof(question));
            }

            _selectMany = SelectMany.Create(question, SelectMany.AsksFor <TSource>(), selector, SelectMany.AsksFor <TResult>());
        }
コード例 #2
0
ファイル: SelectManyAction.cs プロジェクト: venotp/tranquire
        /// <summary>Record Constructor</summary>
        /// <param name="action">The question to get the result from</param>
        /// <param name="selector">The function to apply of the question result.</param>
        public SelectManyAction(IAction <TSource> action, Func <TSource, IAction <TResult> > selector)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            _selectMany = SelectMany.Create(action, SelectMany.Execute <TSource>(), selector, SelectMany.Execute <TResult>());
        }
コード例 #3
0
        /// <summary>
        /// Projects the result of an asynchronous question into a new question.
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="source">The question which result is transformed</param>
        /// <param name="selector">A transform function that returns a new question.</param>
        /// <returns></returns>
        public static IQuestion <Task <TResult> > SelectMany <TSource, TResult>(this IQuestion <Task <TSource> > source, Func <TSource, IQuestion <TResult> > selector)
        {
            var selectMany = SM.Create(source, SM.AsksFor <Task <TSource> >(), selector, SM.AsksForAsync <TResult>());

            return(selectMany.ToQuestion());
        }
コード例 #4
0
        /// <summary>
        /// Projects the result of a question into a new action.
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="source">The question which result is transformed</param>
        /// <param name="selector">A transform function that returns a new action.</param>
        /// <returns></returns>
        public static IAction <TResult> SelectMany <TSource, TResult>(this IQuestion <TSource> source, Func <TSource, IAction <TResult> > selector)
        {
            var selectMany = SM.Create(source, SM.AsksFor <TSource>(), selector, SM.Execute <TResult>());

            return(selectMany.ToAction());
        }
コード例 #5
0
ファイル: ActionExtensions.cs プロジェクト: lanicon/tranquire
        /// <summary>
        /// Projects the result of an asynchronous action into a new action.
        /// </summary>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="source">The action which result is transformed</param>
        /// <param name="selector">A transform function that returns a new action.</param>
        /// <returns></returns>
        public static IAction <Task <TResult> > SelectMany <TResult>(this IAction <Task> source, Func <IAction <Task <TResult> > > selector)
        {
            var selectMany = SM.Create(source, SM.Execute <Task>(), selector, SM.ExecuteAsync <Task <TResult> >());

            return(selectMany.ToAction());
        }