views:

44

answers:

1

Is there a tool that can run through a visual studio solution and adjust access modifiers to anything not being called in the solution is converted to private or internal where applicable?

I suppose I could just change everything to private, and then use the compiler messages and do it by hand...but that could take a while, if there was something automatic, that would be fantastic!

+1  A: 

With NDepend you can analyze your code for stuff like this. It has a SQL-like query language where you can select all the members that are public and could be internal or private, like this:

SELECT METHODS WHERE CouldBeInternal
SELECT METHODS WHERE CouldBePrivate

EDIT: See this blog post about Optimal Encapsulation.

Tommy Carlier