I’m wondering why should I use a class that inherits from the EventArgs class instead of using a custom class that will do the same job for me when passing event data?
I’m wondering why should I use a class that inherits from the EventArgs class
Share
You don’t have to inherit from
EventArgs, but it allows people using your classes to use and handle generic*Handler(object sender, EventArgs e)declarations.If you don’t inherit from
EventArgs, then they have to use explicitly typedThe same goes for just using custom delegates but they are a lot more explicitly different.