I know we cannot do this at class level but at method level we can always do this.
var myList=new List // or something else like this
<
The var
keyword was invented specific to support anonymous types. You are generally NOT going to declare anonymous types at the class level, and thus it was not implemented.
Your example statement
var myList=new List
is not a very good example of how to use the var
keyword since it's not for the intended purpose.