public static AccountState Apply(this AccountState @this, Event evt) => new Pattern <AccountState> { (DepositedCash e) => @this.Credit(e.Amount), (DebitedTransfer e) => @this.Debit(e.DebitedAmount), (FrozeAccount e) => @this.WithStatus(AccountStatus.Frozen), } .Match(evt);