public static async System.Threading.Tasks.Task <R> MatchAsync <R>(this IPublishReplyResult self, System.Func <ReplyValid, System.Threading.Tasks.Task <R> > whenReplyValid, System.Func <ReplyInvalid, System.Threading.Tasks.Task <R> > whenReplyInvalid, System.Func <InvalidRequest, System.Threading.Tasks.Task <R> > whenInvalidRequest) { switch ((self)) { case ReplyValid replyvalid: return(await whenReplyValid(replyvalid)); case ReplyInvalid replyinvalid: return(await whenReplyInvalid(replyinvalid)); case InvalidRequest invalidrequest: return(await whenInvalidRequest(invalidrequest)); default: throw new System.NotSupportedException("This switch statement should be exhaustive"); } }
public static IPublishReplyResult Match(this IPublishReplyResult self, System.Func <ReplyValid, IPublishReplyResult> whenReplyValid, System.Func <ReplyInvalid, IPublishReplyResult> whenReplyInvalid, System.Func <InvalidRequest, IPublishReplyResult> whenInvalidRequest) { switch ((self)) { case ReplyValid replyvalid: return(whenReplyValid(replyvalid)); case ReplyInvalid replyinvalid: return(whenReplyInvalid(replyinvalid)); case InvalidRequest invalidrequest: return(whenInvalidRequest(invalidrequest)); default: throw new System.NotSupportedException("This switch statement should be exhaustive"); } }