C#C
C#2y ago
Tom

✅ Design of events

Hi!
I have a question about utilization of events. Don't know many real life production examples by myself, but counting on your experience 😉
I've noticed that EventHandler delegate takes two parameters: object sender and EventArgs or other defined type. That means that in subscribers we can't be sure what is the sender and what are its properties/methods. So what's the main purpose (by design) of this "sender" parameter, shall it be used to check what type it is and take actions based on that? I am aware that I can create my own type of event instead of using EventHandler, but anyway I'm curious about the real life usage of the sender object.
Was this page helpful?