Edit 2: Actually SomeEventHandler is more concise than OnSomeEventHandler:
If I let Visual Studio generate an event handler for me, the name is like this:
private void ControlOrFormName_SomeEvent(object sender, SomeEventArgs e) { }
For example, the Load event handler of a form becomes:
private void MyForm_Load(object sender, EventArgs e) { }
I don’t find this scheme attractive, it has an underline, etc. Besides, it’s private, so I thought of this:
private void LoadHandler(object sender, EventArgs e) { }
I expect this won’t confuse anyone (it’s an open source project I’m starting) and since it resides in the control, I see no other possible meaning for MyForm.LoadHandler().
Does this make sense? Am I missing something that warrants the name having the class name?
There’s already an
OnLoadmethod in the baseFormclass, as well as many otherOnEventmethods that are protected. You generallyoverridethese methods in your child classes when required.In your form’s code type
protected override OnandIntelliSensewould show you that this naming convention is already used so if you defined the same methods you would hide the inherited members.Update
It’s up to you but the important thing is being consistent with whatever naming convention you choose throughout the project and making sure everyone in the dev team is aware of the naming convention. Personally, I wouldn’t bother as it would cause unnecessary headache later on when the project grows.