Oscar Mederos
Oscar Mederos

Reputation: 29843

Naming Event Handlers: How to make the first letter uppercase

I usually name the controls of my window application starting with a lowercase letter. Eg:

startButton
optionsListBox

And when I suscribe (through VS) to an event of one of those controls, it automatically gives names like:

startButton_Click
optionsListBox_SelectedIndexChanged

but ReSharper suggests renaming it to:

StartButtonClick
OptionsListBoxSelectedIndexChanged

Reading ReSharper conventions for names of event handlers I saw I can modify through ReSharper how event handlers will be named. Eg:

From $object$_On$event$ to $object$On$event$. That will remove the _ character, but what about the first letter?

Is there a way to tell VS or ReSharper to make event handler names uppercase by default?

Upvotes: 3

Views: 2167

Answers (1)

Julien
Julien

Reputation: 7861

The "EventHandler Naming" extension for Visual Studio 2010 allows you to configure precisely how to generate event handlers from the visual studio designer. For instance you could configure it with "On$(SiteName)$(EventName)" and then specify that the SiteName should be PascalCased.

The extension can be downloaded here

Upvotes: 3

Related Questions