The guidelines I follow for C# has "use var where it's obvious, but explicitly type when not".
So for example I'd write:
var x = new List<Foo>();
Because writing: List<Foo> x = new List<Foo>();
Feels very redundantWhereas I'd write:
List<Foo> x = FooBarService.GetMyThings();
Because it's not obvious what the type is otherwise ( Some IDEs will overlay hint the type there though ).Although with newer language features you can also write:
List<Foo> x = new();
Which is even better.I usually prefer
List<Foo> x = new();
since it gives me better alignment and since it's not confused with dynamic.Nowadays I only use
var x = new List<Foo>();
in non-merged code as a ghetto TODO if I'm considering base types/interface.
I would rename `x` to `foos` and jump to the function/use IDE hints for the exact type when needed.