C# allows dynamic typing, but I'll be damned if I'll use it if I can at all avoid it. (dynamic and var)-Renegade
'var' is not dynamic typing, it's used for static type inference which is super useful for DRY reasons.
'dynamic' is something to be very careful about - it tends to ripple out if you start using it.
-f0dder
I stand corrected.
But close enough. When you look at it, var looks like a dynamic type. e.g. var acme = "Rocket Skates"; vs. var acyou = 500;-Renegade
Sure, it does
look like dynamic types at first, but the distinction is super-important. I personally loathe dynamic typing, but I'm a big fan of type inference, as it makes my life easier without giving up static typed goodness.
I'm not using it everywhere, though - I don't use 'var' when dealing with simple built-in types, and whether to use it when assigning a variable to a method return value isn't always clear-cut either. The goal to strive for is reducing unnecessary clutter, while not adding ambiguity; remove noise so you can focus on the important parts.
Your strings and numbers" samples show that implicit type conversions and operator overloading isn't
always a good idea - and, especially since C# has such nice string formatting, it int-to-string conversion should IMHO have been explicit.
I've noticed that with dynamic -- it tends to be infectious. I've found it's useful for dealing with JSON and all that gooey webishness. -Renegade
Can't get by just with anonymous types?