Reputation: 327
I have just installed a new version of Visual Studio 2017 and the studio recommends me, that I should use Pascal case for private methods (void PrivateMethod()). Everything is okay, it's just the name convention. I use usually Camel case (void privateMethod()). I don't intend change my style.
However why does the Visual Studio 2017 generate the private methods for FormsApp wrong by their name convention? -> private void button3_Click(object sender, EventArgs e) Then it recommends me I should change the name to Button3_Click.
It's nothig important but I'm just curious about that. Probably a mistake on the Microsoft's side?
Upvotes: 2
Views: 2878
Reputation: 31
VS 2017 lets you specify the code style you want.
Look for Tools > Options > Text Editor > C# > Code Style > Naming
The 'Manage Styles' button lets you add a "lowerPascalCase" style, and the '+' button lets you add a new rule that uses that style for Private Methods. The 'Severity' column lets you determine how draconian the enforcement of the rule should be.
Make sure to sort your new rule above the 'Non-Field Members' in the list.
Upvotes: 3