For months now I've been working on a C# WinForms project. Things are supposed to be easy for me, cause C# is just a copy of Java, right? Well sure, ok, I'm using C# 2.0, so I'm not supposed to see so much divergence from Java. True enough. There are grave differences however in a lot of areas, generics and events for example. Right this time, I've to delve into the latter.
Event-based programming is a powerful mechanism to enable two-way and multiplexed communication between interested parties. Event-based programming is main usage of the Observer pattern. Events are used extensively in GUI programming. That's why in Java, the events-mechanism is part of the AWT package of the standard library. In .Net world however, it's part of the core framework, which makes it a tad harder to comprehend -- although it allows for more diverse usage of them. For advanced examples check the very useful Pro C# 2005 and the .NET 2.0 Platform, Third Edition book from Apress. For a simple, Java-C# side-by-side comparison see Dare's post.