Naming Rule for Event Handlers

Nathan Sokalski 4,111 Reputation points
2021-11-06T20:09:21.603+00:00

I want most methods in my code to start with a capital letter, and this is what Visual Studio 2019's Code Style Naming Rule currently does. However, most of my event handlers start with a lower case letter, such as the following:

private void btnRoundOneTab_Click(object sender, EventArgs e)

So based on the current naming rule, my event handlers give a Naming rule violation. This may not prevent my code from running, but seeing all those extra squiggly lines is very annoying. I know that I can disable the naming rule for individual methods or ranges of code, but doing this adds a lot of extra code (since I obviously have a lot of event handlers). Is there any way to make the Code Style recognize my event handlers (such as regular expressions or parameters) so that I can use a different style for my normal methods & event handlers?

Developer technologies | Visual Studio | Other
Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2021-11-06T22:30:51.67+00:00

    See under Tools -> Options

    147045-figure1.png

    147046-figure2.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.