uncategorized

C# 3.0 and the var type, Part 2

I didn’t cover this off in [my previous post on the topic](https://www.igloocoder.com/2007/03/17/Constructors-in-C-3-0/, but while I was working on my last post to see if I could get the new constructor syntax to break, I started to wonder if I could use the var keyword to define properties, public fields and return values for methods.

The answers?  The keyword var can only appear within a local variable declaration.  So nothing publicly exposed can have the type var.  This also includes parameters in methods and constructors.

This reinforces with me that the keyword var will not be able to become another incarnation of the variant type from VB6 and  prior.