是否有可能使Resharper的工具"清理代码"(在Visual Studio中)将所有var内容更改为显式类型?
示例:我喜欢这个:
var person = new Person();
Run Code Online (Sandbox Code Playgroud)
改为:
Person person = new Person();
Run Code Online (Sandbox Code Playgroud)
建议解决方案后编辑:
也许我做错了什么,但它对我不起作用:

您可以在Code Cleanup下的(Resharper)选项中进行设置.只需创建一个新的配置文件/修改现有配置文件,然后导航到C# - >在声明中使用'var'.将"Replace direction"设置为"Can(change)'var'到type usage"和"Local variable declaration style"到"Always use explicit type"
| 归档时间: |
|
| 查看次数: |
3108 次 |
| 最近记录: |