Due to the disappointing fact of having public as default modificator for classes/structs/enums in both Visual Studio and Resharper, the solution I am working on right now has a huge amount of public classes which are not used outside a library they are defined in. So I want to make all those classes internal. And I don’t want to do it manually.
Is there any way to automate this task? In general I want to have something like Adjust visibility refactoring (similar to Resharper’s Adjust namespaces).
You can find-and-replace using regular expressions. For example in Visual Studio 2012, the following will do what you want (after you enable regular expression matching in the search box):
Replace with:
After that you can use the class view to show only public members and do those that are left manually.
For Visual Studio 2010 the syntax is different. I think it is like this, but could not test it:
Replace with:
You can find more information here.