public static async System.Threading.Tasks.Task <R> MatchAsync <R>(this ICreateProfileResult self, System.Func <ProfileCreated, System.Threading.Tasks.Task <R> > whenProfileCreated, System.Func <ProfileNotCreated, System.Threading.Tasks.Task <R> > whenProfileNotCreated, System.Func <ProfileValidationFailed, System.Threading.Tasks.Task <R> > whenProfileValidationFailed) { switch ((self)) { case ProfileCreated profilecreated: return(await whenProfileCreated(profilecreated)); case ProfileNotCreated profilenotcreated: return(await whenProfileNotCreated(profilenotcreated)); case ProfileValidationFailed profilevalidationfailed: return(await whenProfileValidationFailed(profilevalidationfailed)); default: throw new System.NotSupportedException("This switch statement should be exhaustive"); } }
public static ICreateProfileResult Match(this ICreateProfileResult self, System.Func <ProfileCreated, ICreateProfileResult> whenProfileCreated, System.Func <ProfileNotCreated, ICreateProfileResult> whenProfileNotCreated, System.Func <ProfileValidationFailed, ICreateProfileResult> whenProfileValidationFailed) { switch ((self)) { case ProfileCreated profilecreated: return(whenProfileCreated(profilecreated)); case ProfileNotCreated profilenotcreated: return(whenProfileNotCreated(profilenotcreated)); case ProfileValidationFailed profilevalidationfailed: return(whenProfileValidationFailed(profilevalidationfailed)); default: throw new System.NotSupportedException("This switch statement should be exhaustive"); } }