Posts Tagged ‘GenericEventArgs’

GenericEventArgs

February 3, 2008

A small and helpful class that I find myself adding to every single project I start these day is ”GenericEventArgs”.

Microsoft included the System.EvenHandler<T> class in .NET, taking away the need to create custom delegates to enable the use of custom event arguments . This class takes it one step further. It’s a simple generic class with the signature EventArgs<T>, deriving from System.EventArgs. It accepts a single instance of T thru the constructor which it exposes via a property “Value” of the type T.

Now where I would earlier create custom eventarg classes to pass a single argument with an event, I simply use this generic implementation.

(more…)

Advertisements