Question

In my solution, I have a method setup like this

void OnFooLoaded(param bar)
{
    // method body
}

Using ReSharper 7, it suggests that I can make the method either public, internal or protected. I cannot seem to figure out where I can change this, so the method signature has to have a visibility modifier (i.e private, public etc.) Should I look under Resharper Options -> Code Inspection -> Inspection Severity or is there somewhere else I'm missing a setting?

Was it helpful?

Solution

In ReSharper, to add access modifiers or not is a formatting preference. You can change it at ReSharper | Options -> Code Editing | C# | Formatting Style | Other | Modifiers. Turn on Use explicit ... to always add modifiers when making code cleanup or turn them off not to do it.

But ReSharper can't highlight or underline places where wrong formatting style is used (for example, where there is no access modifiers). You should try StyleCop for this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top