开发者

Automatically Refactor Access Modifiers

Is there a tool that can run through a visual studio solution and adjust access modifiers to anything not being called in the solu开发者_开发百科tion 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜