Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure VS 2010 so that it doesn't add new EventHandler(...); when adding an EventHandler via += [duplicate]

Possible Duplicate:
Can I customize automatic event handler generation in Visual Studio ?

Can I configure VS2010 Intellisense so that it does this:

SomeEvent += Some_Method;

instead of this:

SomeEvent += new EventHandler(Some_Method);

when adding an EventHandler via += and pressing the Shift key?

I understand that this doesn't make any difference as far as the generated IL is concerned but I personally much prefer the first version. It is easier to read and I don't have to go and fix the += / -= calls when I go and change the EventHandler type to something different.

like image 831
Patrick Klug Avatar asked Mar 21 '11 00:03

Patrick Klug


People also ask

How do you declare an EventHandler?

Use the EventHandler delegate for all events that do not include event data. Use the EventHandler<TEventArgs> delegate for events that include data about the event. These delegates have no return type value and take two parameters (an object for the source of the event, and an object for event data).

What is an EventHandler?

In programming, an event handler is a callback routine that operates asynchronously once an event takes place. It dictates the action that follows the event. The programmer writes a code for this action to take place. An event is an action that takes place when a user interacts with a program.

Which method is used to attach one or more event handlers?

The mouseleave() method attaches an event handler function to an HTML element.


1 Answers

Nope, sorry. I just go with the default behavior and then delete the extra fluff after it's stubbed out the method for me.

like image 112
Robert Levy Avatar answered Nov 09 '22 06:11

Robert Levy