I use var widely. There has been criticism that this reduces the readability of the code, but there is no argument to support this claim.
Admittedly, this may mean that it is not clear what type we are dealing with. So what? This is actually the point of unleashed design. When working with interfaces, you are definitely not interested in the type of variable. var accepts this a lot more, true, but I believe that the argument remains in terms of readability: The programmer should not really be interested in the type of the variable, but rather in what the variable does. This is why Microsoft also calls duck print output type.
So what does a variable do when I declare it using var? Easy, he told me what IntelliSense does. Any reasoning about C # that the IDE ignores is lacking in reality. In practice, each C # code is programmed in an IDE that supports IntelliSense.
If I use the declared var variable and get confused that the variable is there, there is something fundamentally wrong with my code. Var is not the cause; it only makes the symptoms visible. Do not blame the messenger.
Now the C # team has issued an encoding guide that states that var should be used to capture the result of the LINQ statement, which creates an anonymous type (because here we have no real alternative to var). Well, let it go. As long as the C # team does not give me a sound argument for this guide, I am going to ignore this because in my professional and personal opinion, this is purely a balonie. (Sorry, I have no reference to the guideline.)
Actually, there are some (superficial) good explanations why you should not use var, but I still think that they are mostly wrong. take the example of "searchabililty": the author claims that the var makes it difficult to search for places where MyType is used. Correctly. So are the interfaces. In fact, why do I want to know where the class is used? I may be more interested in where it will still be searchable, because somewhere its constructor must be called (even if this is done indirectly, the type name is mentioned somewhere). - Conrad Rudolph