3

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?

Community
  • 1
  • 1
Oscar Mederos
  • 29,016
  • 22
  • 84
  • 124
  • 1
    With ReSharper, you currently can't do that. Please file a feature request to youtrack.jetbrains.net if you'd like to see this improvement in future ReSharper versions. Thanks – Jura Gorohovsky Mar 09 '11 at 13:14

1 Answers1

3

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

Julien
  • 7,821
  • 3
  • 23
  • 16