Usually when I subscribe to an event, I use the Visual Studio builtin function to generate the method. So if I want to bind a clicked event to a button after I write +=
I click tab one time to generate the code after +=
, and then tab again to create the empty method associated with this event.
So for a button clicked event, I will end up with something like this:
button.Clicked += new EventHandler(button_Clicked);
void button_Clicked(object sender, EventArgs e) {
throw new NotImplementedException();
}
Since I prefer the shorter syntax for binding the eventhandler, I always go back to the autogenerated line, and change it to look like this:
button.Clicked += button_Clicked;
My question is simply. Are there any way to make VS automatically prefer this syntax over the default one, so I don't manually have to go and change this every time.
This applies both for VS2008 and VS2010