By default Resharper creates all methods, properties, and classes as public. Does anybody know how to change it to internal instead?
Thanks a lot.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as I know there’s no way to do that out of the box in ReSharper. In many cases ReSharper goes the safest path when setting visibility to the code it generates but apparently there is some visibility heuristics in place, especially when it comes to generating type members.
ReSharper provides a more general-purpose way of ensuring that you have visibility set to a necessary minimum. If you turn on solution-wide analysis, it will trigger code inspections that will look how members are actually used, and suggest that you make certain members private, protected etc, depending on the results of usage analysis.
As soon as you see a code inspection like this, you can press Alt+Enter and select “Find similar issues”, set a scope, and get the list of all members in the given scope for which visibility can be reduced. Note that “Find similar issues” is only available starting from ReSharper 6.
Alternatively, you can right-click a node in Solution Explorer, select Find Code Issues, and as soon as you have the list of all found issues, set filters to only show visibility problems (this would be a set of inspections under “Common practices and code improvements”). This can be done in ReSharper 5 or higher.
Irrelevant of which way you choose, you’ll need to turn solution-wide analysis on beforehand.