I know the naming convention for class methods in C# is to begin with a capital letter and each new word is a capital letter (e.g. GetDeviceName).
So my question is why when I create a form, place a control on it, then double click the control (for the method to be created automatically for me by the IDE) I get a method begining with a non-capital letter ? (e.g. selectButton_Click(object sender, EventArgs e) )
The naming convention for event handlers of controls have always been
controlName_EventName, so basically, it reuses your own naming convention for the control, and then tucks on the name of the event.This might be contrary to the general naming standard, but it has always been this way.
The upshot of this, is that tools like GhostDoc can recognize this format, and thus generate documentation that, while still generic, is more to the point, than if it were to try to deduce the purpose of the method by itself.
For instance, the “controlName_EventName” method could be documented like this:
instead of more like this (since GhostDoc handles the above, I’m ad libbing here based on experience with bad method names):