Usually, when I subscribe to an event, I use the built-in Visual Studio function to generate the method. Therefore, if I want to attach the clicked event to a button after I write += , I press tab once to generate the code after += , and then again on the tab to create an empty method associated with this event.
So, for a button click event, I get something like this:
button.Clicked += new EventHandler(button_Clicked); void button_Clicked(object sender, EventArgs e) { throw new NotImplementedException(); }
Since I prefer a shorter syntax for binding an event handler, I always go back to the auto-generated line and change it like this:
button.Clicked += button_Clicked;
My question is simple. Is there a way to make VS automatically prefer this syntax by default, so I don’t need to manually switch and change this every time.
This applies to both VS2008 and VS2010.
source share