I wanted to use the var
keyword to declare a field in my class however var
only seems to work inside methods.
The code I have looks like:>
From the C# reference
Also from The C# Programming Reference
It just isn't intended for the usage you have in mind.
It's primary aim is to allow the support of anonymous types in your code, with the added advantage of allowing a nice terse way of specifying local variables.