Resharper and Microsoft's naming conventions. How do i set up? WPF / Silverlight

Using ReSharper will begin and there will be some problems. I got most of the material, but I can’t decide what to do with it:

  • VS automatically creates Window_Loaded, Button_OnClick, etc. Resharper says there should be no underscore. How can I fix all this?

  • How do I name controls and windows in WPF? I call them btnSubmit, wndMain, etc., but obviously this is not what ReSharper prefers. Are SubmitButton and MainWindow Improved?

Prefix

worked for me in the past since I see items sorted by collections, but maybe this is wrong? Any suggestions would be helpful. I am in great pain with all these StyleCops, etc. :)

+8
c # naming-conventions wpf silverlight resharper
source share
3 answers

Question 1)

Just unplug as shown below.

// ReSharper disable InconsistentNaming private void btnCreateChannel_Click(object sender, RoutedEventArgs e) // ReSharper restore InconsistentNaming { SetupChannel(); } 

Question 2)

Follow Microsoft's naming convention -> here

+7
source share

Agreements are largely up to you. The only place they really matter is where the framework is based on these agreements. ie MVC EF 4.1 ...

Many can argue for a long time about prefixes. Many will tell you that with the tools we use today, prefixes are not important and can be discarded.

But in some cases, I still like to use prefixes like p_ and m_ just because I like working with local copies and never with parameters.

This is also a matter of preference. In some cases, the presence of string strName = string.Empty; can be quite repetitive.

You can edit the ReSharper conventions to reflect what you would like to apply throughout your project.

This is great when a team shares these settings. It really helps to maintain a consistent style. ReSharper's default conventions are great. I often suggest sticking to these rules and changing them when you go.

+2
source share

If your tools tell you about conflicting things, turn off one of them. It doesn't matter that, although it might be easier to disable the ReSharper rule, than to change the way that Visual Studio events are named.

The important thing in coding standards is that you are compatible throughout the project and between developers. There is no "right" way. Go with what is easiest to implement.

0
source share

All Articles