开发者

ReSharper: automatically apply "var" upon semicolon?

开发者 https://www.devze.com 2022-12-27 17:00 出处:网络
When I type the semicolon, ReSharper does certain things to the line of code I\'ve just authored.Can I include in those actions the removing of the explicit type specification (and replacing it with \

When I type the semicolon, ReSharper does certain things to the line of code I've just authored. Can I include in those actions the removing of the explicit type specification (and replacing it with "var")?

string foo = ""

... and 开发者_运维技巧then I type the semicolon, and the line of code is automatically re-written as follows?

var foo = "";

EDIT: I'm using 4.5 -- I'll move to 5.x soon.


I use "Clean Up Code" in Resharper to make the changes. But I use var everywhere possible anyway - so it only makes a difference to old code. I think it is worth getting youyr settings for "Clean Up Code" just right and applying it to all of your code - it means that the style is always consistent and diffs are always consistent.

0

精彩评论

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