I was reading some C# coding standards and it has this:
“The event handler should not contain the code to perform the required action. Rather call another method from the event handler”
I was wondering if there is a reason for this (performance or something else) or if it is just a style preference?
An event handler is meant to connect the GUI to your business logic.
If you have a textbox to enter a user’s name and an Add button, clicking the Add button should merely call
_userRepository.AddUser(UsernameTextbox.Text). You don’t want business logic in event handlers.