All rules
IDE0007var preferences MS default: Suggestion

Use var

Prefer `var` over an explicit type in local variable declarations.

Microsoft docs
Documented together with IDE0008Use explicit type instead of var

Description

Encourages implicitly typed local variables with var. Reduces redundancy when the type is already obvious from the right-hand side.

Why it matters

Consistent use of var reduces noise and keeps declarations focused on intent rather than type names.

Examples

Avoid
List<Order> orders = new List<Order>();
Prefer
var orders = new List<Order>();

Configurable options

Vote for the value each option should take in the generated .editorconfig.

csharp_style_var_for_built_in_types
default: false
csharp_style_var_when_type_is_apparent
default: false
csharp_style_var_elsewhere
default: false
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0