Disable automatic private modifier in ReSharper

If you use ReSharper, you notice that every time you create a global class variable without a modifier, ReSharper will add a private modifier for you.

You type:

string name;

ReSharper formats:

private string name;

Some people may be prefer this way.  I personally don’t see what values it adds.  My brain already knows that if there’s no modifier for a variable, than this variable is private.  I don’t need any extra information for my brain to process and filter.

Luckily for me ReSharper has an option to turn this feature off.

  1. Lunch ReSharper – Options dialog box.
  2. On the left part of the dialog select C#/Formatting Style/Other
  3. On the right part of the dialog uncheck ‘Use explicit private modifier’.


kick it on


6 thoughts on “Disable automatic private modifier in ReSharper

  1. I strongly prefer explicit “private” and “internal” myself.

    Of course that might just be a throwback to my Java days where lack of an accessibility keyword meant “package” visibility. A subtle gotcha…

    1. I don’t have a copy of R# 10 yet. In 9.2 it’s not in Formatting Style anymore. You can find ‘Use explicit private modifier’ in Code Style under Modifiers section. Let me know if you still cannot find it in 10.1.

    2. Ciaran, I just updated my version of R# to 10 and the option is there. Go to Options > Code Editing > C# > Code Style. When there go to Modifiers and change from Explicit to Implicit for the first item “Prefer explicit/implicit private modifier for type members”.

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