开发者

Automatically Refactor Access Modifiers

开发者 https://www.devze.com 2022-12-13 15:51 出处:网络
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 applicab

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

精彩评论

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