I would like to be able to control the default code that's generated for event's when I use one of Visual Studio's automatically generated blocks. The current template is as follows:
void HandlerName(object sender, HandlerEventArgs e) {
throw new NotImplementedException();
}
I would like to change this to the following:
private void HandlerName(object sender, HandlerEventArgs args) {
throw new NotImplementedException();
}
Namely it's the args
argument that I always change.
UPDATE: Further to this it is policy that we also include comments for private members here, thus another use-case for my requirement is to also generate the default comment.
UPDATE 2: I now retract the reasoning for wanting to rename e
to args
due to evidence of a non-standard naming convention, however I still would like to override the template if possible for explicit access modifier and default comments.
An event handler is the code you write to respond to an event. An event handler in Visual Basic is a Sub procedure. However, you do not normally call it the same way as other Sub procedures. Instead, you identify the procedure as a handler for the event.
From the Class Name drop-down list at the top of the Code Editor, select the object that you want to create an event handler for. From the Method Name drop-down list at the top of the Code Editor, select the event. Visual Studio creates the event handler and moves the insertion point to the newly created event handler.
Clicking on a button, or entering some text in a text box, or clicking on a menu item, all are examples of events. An event is an action that calls a function or may cause another event. Event handlers are functions that tell how to respond to an event. VB.Net is an event-driven language.
I think the e
comes from the delegate signature (delegate void HandlerEventHandler(object sender, HandlerEventArgs e)
), so you can't change it without also changing the delegate signature...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With