Editorconfig Guide.e

var when type is apparent

EditorConfig key: csharp-style-var-when-type-is-apparent

var when type is apparent

csharp-style-var-when-type-is-apparent

This option controls whether var should be preferred when the type is apparent from the right-hand side of the assignment.

Default value:

false

Possible values:

  • true
  • false

Examples

true
var x = new List<int>();
false
List<int> x = new List<int>();