Why can’t class fields be var? [duplicate]

Eric Lippert answered your question right here: Why no var on fields?

Basically, for the general case it would require re-writing the C# compiler, as the way it currently does type inference would not work for cycles of var field variable assignments.

Leave a Comment