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
Because the universal signature of event handler methods was invented long before generics were ever added to the language.
Using
System.Objectwas the logical choice in the days before generics, as it really was the most “generic” object available. All other objects ultimately derive fromSystem.Object, including controls, BCL classes, and user-defined classes, because it is at the root of the type hierarchy.