While subscribing to any event much easier not create a separate handler method, but use anonymous method like this example:
Button.Click += new EventHandler((obj, args) =>
{
});
Code much more readable, in my opinion. For example, we want create new wpf window, subscribe to “Closing” event, and do some stuff on closing.
If we gonna use anonymous function method, all your code logic stays in one place, and not divided on two pieces -> subscribing at one place and closing logic thrown
within method handler to bottom of cs file.
Button.Click += new EventHandler((obj, args) =>
{
});
Code much more readable, in my opinion. For example, we want create new wpf window, subscribe to “Closing” event, and do some stuff on closing.
If we gonna use anonymous function method, all your code logic stays in one place, and not divided on two pieces -> subscribing at one place and closing logic thrown
within method handler to bottom of cs file.