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?
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
精彩评论