public static async System.Threading.Tasks.Task <R> MatchAsync <R>(this IPostAnswerResult self, System.Func <PostAnswer, System.Threading.Tasks.Task <R> > whenPostAnswer, System.Func <AnswerNotPosted, System.Threading.Tasks.Task <R> > whenAnswerNotPosted, System.Func <AnswerValidationFailed, System.Threading.Tasks.Task <R> > whenAnswerValidationFailed) { switch ((self)) { case PostAnswer postanswer: return(await whenPostAnswer(postanswer)); case AnswerNotPosted answernotposted: return(await whenAnswerNotPosted(answernotposted)); case AnswerValidationFailed answervalidationfailed: return(await whenAnswerValidationFailed(answervalidationfailed)); default: throw new System.NotSupportedException("This switch statement should be exhaustive"); } }
public static IPostAnswerResult Match(this IPostAnswerResult self, System.Func <PostAnswer, IPostAnswerResult> whenPostAnswer, System.Func <AnswerNotPosted, IPostAnswerResult> whenAnswerNotPosted, System.Func <AnswerValidationFailed, IPostAnswerResult> whenAnswerValidationFailed) { switch ((self)) { case PostAnswer postanswer: return(whenPostAnswer(postanswer)); case AnswerNotPosted answernotposted: return(whenAnswerNotPosted(answernotposted)); case AnswerValidationFailed answervalidationfailed: return(whenAnswerValidationFailed(answervalidationfailed)); default: throw new System.NotSupportedException("This switch statement should be exhaustive"); } }