コード例 #1
0
        public static async System.Threading.Tasks.Task <R> MatchAsync <R>(this ICreateTenantResult self, System.Func <TenantCreated, System.Threading.Tasks.Task <R> > whenTenantCreated, System.Func <TenantNotCreated, System.Threading.Tasks.Task <R> > whenTenantNotCreated, System.Func <InvalidRequest, System.Threading.Tasks.Task <R> > whenInvalidRequest)
        {
            switch ((self))
            {
            case TenantCreated tenantcreated:
                return(await whenTenantCreated(tenantcreated));

            case TenantNotCreated tenantnotcreated:
                return(await whenTenantNotCreated(tenantnotcreated));

            case InvalidRequest invalidrequest:
                return(await whenInvalidRequest(invalidrequest));

            default:
                throw new System.NotSupportedException("This switch statement should be exhaustive");
            }
        }
コード例 #2
0
        public static ICreateTenantResult Match(this ICreateTenantResult self, System.Func <TenantCreated, ICreateTenantResult> whenTenantCreated, System.Func <TenantNotCreated, ICreateTenantResult> whenTenantNotCreated, System.Func <InvalidRequest, ICreateTenantResult> whenInvalidRequest)
        {
            switch ((self))
            {
            case TenantCreated tenantcreated:
                return(whenTenantCreated(tenantcreated));

            case TenantNotCreated tenantnotcreated:
                return(whenTenantNotCreated(tenantnotcreated));

            case InvalidRequest invalidrequest:
                return(whenInvalidRequest(invalidrequest));

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