且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将C#var重构为显式类型的工具

更新时间:2023-11-29 09:33:52

我有ReSharper 4.1,它确实提供了这个选项(在任何一个方向上)。

I've got ReSharper 4.1, and it does offer this option (in either direction).

实际上,我建议挑战该标准。 。前者比后者更具可读性(特别是如果您调用变量 pair 或类似的名称)。对于 var i = 0 ,我不会使用 var,但是它非常适合以上情况。

Actually, I'd recommend challenging the standard... the former is far more readable than the latter (especially if you call the variable pair or something similar). I would't use "var" for var i = 0, but it is ideally suited to the above.

要进行批量更改,请访问:

For bulk changing, go to:


  • 清理代码...(选择一个配置文件=>编辑配置文件 =>工具=>代码清除)


    • C#


      • 在声明
        中使用'var'

        • 替换方向=可以'var'键入用法

        • 'foreach'迭代器声明样式=始终使用显式类型

        • 局部变量声明样式=始终使用显式类型

        并运行...