开发者

ReSharper - var hint only for none basic type

开发者 https://www.devze.com 2023-01-03 19:14 出处:网络
I like the fact that ReSharper suggest me to use the var keyword. Instead, I would like to know if it is possible to ReSha开发者_如何学编程rper to only hints me when I use type that are not basic.

I like the fact that ReSharper suggest me to use the var keyword.

Instead, I would like to know if it is possible to ReSha开发者_如何学编程rper to only hints me when I use type that are not basic.

Example :int myInt = ..., string myString = .... No hint here

I prefer to use var on complex type like : var myHttpModule = ..., var userRepository = ...


I have ReSharper 5 and the only 2 options are "Use 'var' keyword when initializer explicitly declares type" and "use 'var' keyword when possible".

It doesn't seem value vs reference types are an option. I agree though, this would be a nice option.


Alt+Enter menu should have the option to set the settings on that rule. I'm unsure if it supports distinction between the two. My version of ReSharper is old, we're still on VS2008 here.

0

精彩评论

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

关注公众号