KnorxThieus
KnorxThieus

Reputation: 585

Configure ReSharper only to recommend `var` for non-primitive types?

I'm searching for the equivalent to VS csharp_style_var_for_built_in_types option.

For example, I would like to get a recommendation to use var for the following line:

object foo = new object();

But I would like ReSharper to approve the following line:

for (int i = 0; i < 0x2a; i++)

(How) can I achieve this?

Upvotes: 3

Views: 65

Answers (1)

Henrik Wilshusen
Henrik Wilshusen

Reputation: 289

The only options to select are:

Options -> Code Inspection -> Inspection Severity screenshot If you uncheck the built-in types, then

for (int i = 0; i < 0x2a; i++)

would give no warning. But like it says all built-in Types would stop to give a warning.

So string str = ""; would also give no warning.

But maybe the Resharper Forum can help you

Upvotes: 2

Related Questions