// Invoke the Loan event public virtual void OnLoan(LoanEventArgs e) { if (Loan != null) { Loan(this, e); } }
public override void LoanHandler(object sender, LoanEventArgs e) { if (e.Loan.Amount < 45000.0) { Console.WriteLine($"{GetType().Name} approved request# {e.Loan.Number}"); } else if (Successor != null) { Successor.LoanHandler(this, e); } }
public override void LoanHandler(object sender, LoanEventArgs e) { if (e.Loan.Amount < 100000.0) { Console.WriteLine($"{sender.GetType().Name} approved request# {e.Loan.Number}"); } else if (Successor != null) { Successor.LoanHandler(this, e); } else { Console.WriteLine($"Request# {e.Loan.Number} requires an executive meeting!"); } }
public void ClearLoan(LoanEventArgs e) { }
public void Loan(LoanEventArgs e) { }
// Loan event handler public abstract void LoanHandler(object sender, LoanEventArgs e);
// Invoke the Loan event public virtual void OnLoan(LoanEventArgs e) { Loan?.Invoke(this, e); }