Possible Duplicates:
In a C# event handler, why must the "sender" parameter be an object?
Event Signature in .NET — Using a Strong Typed 'Sender'?
Why do all of the events in .NET have their first parameter as of type object
, and not of a generic type T
? Every time I have to get my sender, I have to typecast it to some more derived type. For example:
(Button)sender