littleguru wrote:I had to maintain code in old VB 4,5,6... It's a pain.
variant b = 1
b = "123"
b = 1.2
That's not how var in C# 3.0 works. I forget the word for it, so i'll make one up and hope that's what it is, but I'd call it implicit typing instead of explicit typing. (someone correct me on what the real verbage is if you know).
If you said this...
var b = 1;
b = "123";
...you'd get an exception. When the variable was declared, it's type was set. It's dynamic because when you do things like database queries or whatever in LINQ the type isn't really set until it's called.
I've been out of this stuff for a while so if there are any details I botched up, let me know, but I believe the general idea is correct.