ReSharper 4.5 complains about my private fields.

I just downloaded ReSharper 4.5.  I probably will blog more about my experience with it.

The first thing I noticed after upgrading to R# 4.5 is that I got a lot of complains (blue underlines) about my naming of non public fields. 


Like many developers I like to prefix my private variables with an underscore.  I know for the fact that I’m not alone that what Jeff Prosie says:

As a matter of personal preference, I typically prefix the names of private fields with an underscore (for example, _connection).  When I read the code back after a time away, this makes it obvious to me which fields are not intended for public consumption.  This conventions is used quite a lot in the .NET Framework – for example, in System.NET.HttpWebRequest and System.Web.HttpContext – but it is not used throughout.

Next thing I did is to check what controls this blue lines.  I went to ReSharper/Options/Naming Style.


To satisfy my naming style I click on Edit button to open an Edit “Instance fields (non public)” Rule Settings… window and typed an underscore (_) in Name Prefix text box:


After modifying “Instance fields (not public)” rule, ReSharper will not complain when we  add underscore to our private, internal, and protected fields.  But what if we want this rule for private fields only.  Well, in this case we need to define our own rule.  Naming Style window has two list boxes, the second one (User defined naming rules) allows us to define our own rule.


kick it on


2 thoughts on “ReSharper 4.5 complains about my private fields.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s