Tagged with delegates

One more thing to love about .NET generics: events with custom event args

Lists are a killer app for generics in .NET 2.0 but one of my favourite uses that gets less attention is declaring event handlers without having to create a custom delegeate. Imagine a situation where you want to pass a piece of custom information to the event handler so it can decide whether to cancel [...]
Published in .NET on Saturday, April 26th, 2008

Raising custom events in C#

First you need to declare an event in the class that’s going to raise the event. This is just like declaring a normal variable: public event EventHandler MyEvent; Then you need a method that’s going to be called to raise the event. This goes into the same class that you just declared the event in. [...]
Published in .NET on Wednesday, November 3rd, 2004