Events Revisited
Before getting back to our example, let’s reestablish the way we look at events. Recall how the typical event pattern is based on EventHandler<T>
as the signature of an event and its handlers:
Every time such an event is raised, we get some data that travels from the event source to the listener, represented as an instance of the TEventArgs
argument. In other words, it’s fair to say that events are data sources. For example, in our CountDown
example the event source is really a data source producing decreasing values representing the number of seconds that are left until the countdown finishes.
When someone says data they immediately ...
Get C# 4.0 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.