示例#1
0
        public static async System.Threading.Tasks.Task <R> MatchAsync <R>(this ICreateQuestionResult self, System.Func <QuestionPosted, System.Threading.Tasks.Task <R> > whenQuestionPosted, System.Func <QuestionNotPosted, System.Threading.Tasks.Task <R> > whenQuestionNotPosted, System.Func <QuestionValidationFailed, System.Threading.Tasks.Task <R> > whenQuestionValidationFailed)
        {
            switch ((self))
            {
            case QuestionPosted questionposted:
                return(await whenQuestionPosted(questionposted));

            case QuestionNotPosted questionnotposted:
                return(await whenQuestionNotPosted(questionnotposted));

            case QuestionValidationFailed questionvalidationfailed:
                return(await whenQuestionValidationFailed(questionvalidationfailed));

            default:
                throw new System.NotSupportedException("This switch statement should be exhaustive");
            }
        }
示例#2
0
        public static ICreateQuestionResult Match(this ICreateQuestionResult self, System.Func <QuestionPosted, ICreateQuestionResult> whenQuestionPosted, System.Func <QuestionNotPosted, ICreateQuestionResult> whenQuestionNotPosted, System.Func <QuestionValidationFailed, ICreateQuestionResult> whenQuestionValidationFailed)
        {
            switch ((self))
            {
            case QuestionPosted questionposted:
                return(whenQuestionPosted(questionposted));

            case QuestionNotPosted questionnotposted:
                return(whenQuestionNotPosted(questionnotposted));

            case QuestionValidationFailed questionvalidationfailed:
                return(whenQuestionValidationFailed(questionvalidationfailed));

            default:
                throw new System.NotSupportedException("This switch statement should be exhaustive");
            }
        }
示例#3
0
        public static R Match <R>(this ICreateQuestionResult self, System.Func <QuestionCreated, R> whenQuestionCreated, System.Func <QuestionNotCreated, R> whenQuestionNotCreated, System.Func <QuestionPublished, R> whenQuestionPublished, System.Func <QuestionNotPublished, R> whenQuestionNotPublished)
        {
            switch ((self))
            {
            case QuestionCreated questioncreated:
                return(whenQuestionCreated(questioncreated));

            case QuestionNotCreated questionnotcreated:
                return(whenQuestionNotCreated(questionnotcreated));

            case QuestionPublished questionpublished:
                return(whenQuestionPublished(questionpublished));

            case QuestionNotPublished questionnotpublished:
                return(whenQuestionNotPublished(questionnotpublished));

            default:
                throw new System.NotSupportedException("This switch statement should be exhaustive");
            }
        }
示例#4
0
        public static async System.Threading.Tasks.Task <ICreateQuestionResult> MatchAsync(this ICreateQuestionResult self, System.Func <QuestionCreated, System.Threading.Tasks.Task <ICreateQuestionResult> > whenQuestionCreated, System.Func <QuestionNotCreated, System.Threading.Tasks.Task <ICreateQuestionResult> > whenQuestionNotCreated, System.Func <QuestionPublished, System.Threading.Tasks.Task <ICreateQuestionResult> > whenQuestionPublished, System.Func <QuestionNotPublished, System.Threading.Tasks.Task <ICreateQuestionResult> > whenQuestionNotPublished)
        {
            switch ((self))
            {
            case QuestionCreated questioncreated:
                return(await whenQuestionCreated(questioncreated));

            case QuestionNotCreated questionnotcreated:
                return(await whenQuestionNotCreated(questionnotcreated));

            case QuestionPublished questionpublished:
                return(await whenQuestionPublished(questionpublished));

            case QuestionNotPublished questionnotpublished:
                return(await whenQuestionNotPublished(questionnotpublished));

            default:
                throw new System.NotSupportedException("This switch statement should be exhaustive");
            }
        }