开发者

c# - make all vars explicit typed at once

The var keyword in c# is a great time saver while your coding, but when you are looking back at code that's not fresh in your mind, it's more helpful to have explicit types in the code.

I have code rush expre开发者_开发知识库ss which allows me to "Make Explicit" 1 var keyword at a time.

Are there any tools or add ins that will convert many of them at once?


Yes Resharper can do this using the code clean up macros. Whether you want to enforce explicit or implicit types is a setting.


Coderush is based on an open framework or api freely available on DX website. Not sure now but i think is called DxCore. you can download it and play with that to make your own extension for CodeRush. I would not do it anyway, there is really nothing wrong in the usage of var unless some very specific cases when it is really not obvious to understand what it will contain.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜