Delegates (Continued)

Learn how to use delegates to decouple logic and implement flexible event notification systems.

We have focused on syntax so far, but we must also understand the practical applications. Developers often ask why delegates are necessary when methods can be called directly.

Delegates are essential for decoupling code. Suppose we have a class that represents a football game. It tracks the events of the game and updates its state accordingly. For simplicity, our FootballMatch class only tracks the scores.

The following code defines a basic class to hold match state.