XAML-based applications - Event Naming Conventions for C#
- by user118190
For event handling, I am starting to see many coders doing this:
XButton.Click += OnXButtonClicked()
...
void OnXButtonClicked()
{ ... }
Where did this On_ convention come from? It just doesn't feel right in terms of methods.
I am starting to see this as well and am wondering what others thought:
XButton.Click += HandleXButtonClick()
...
void HandleXButtonClick()
{ ... }
When using intellisense, Visual Studio handles these like so:
XButton.Click += XButton_Click;
...
void XButton_Click(object sender, RoutedEventArgs e)
{ ... }
I am seeking some advice on these naming conventions and would greatly appreciate some advice.