Best practices question.
While I was writing some event handlers, I ran into an issue where I as looking at the incorrect event (GridViewRowEventArgs) when I should have been looking at something else.
Now to solve my problem, instead of referencing the very specific event I was looking at, I just used EventArgs, which seems to catch any possible event. So, finally to the question; is there an issue with using EventArgs instead of the specific event? is it better to use the specific one for debugging issues? What is everyone’s opinion?
Thanks
If a control is compliant then their event arg classes will always inherit from the generic ASP-provided
EventArgs, which is why your approach works. Ultimately, if you don’t need the extra information provided by the control through their own custom event arguments class then obviously you can dispense with using it altogether.However, from a best practice perspective, my feeling is that it would be better to use the correct handler signature provided by the control, since that makes it predictable to people who might be working on your code and can’t read your mind, but do have access to the the particular control’s documentation.