Re: c# v3.0: implicit variable declaration, why?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Brian Gideon <briangideon@xxxxxxxxx> wrote:
That's quite tricky in the case where you're using anonymous types as
provided by LINQ: an explicit declaration is *impossible* in that case.
I personally think that having anonymous types is worth the potential
problems of "var", although I would imagine that there'll be a lot of
code checkers which make sure you don't use it where you don't need
to...

I wonder if a compiler warning could be added for the trivial misuse of
the var declaration. I'm not sure how feasible it would be...I'm just
thinking out loud right now.

I'd been wondering the same thing, to be honest...

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.