Is C# Becomming VB?
I didn’t make it to PDC this year, but plenty of bloggers have posted plenty of information about what they’ve found most interesting.
The most amusing post that I’ve seen that doesn’t intend to be amusing is Ted Neward’s analysis of the new features coming in C# 3.0 that will arrive at some well-into-the-future date. It seems that C# is becoming VB, if not in syntax at least in features.
Check out implicitly-typed variables, in which you can do something like this (these are Ted’s examples):
var i = 5;
var s = "This is an implicitly typed local variable";
var a = new int[] { 1, 2, 3 };
(Note that a var is not a variant. The variables are strongly typed, it’s just that the compiler is figuring out the type.) So i becomes an Int32, s becomes a string, and a an Int32 array. Then check out object initializers, where the compiler will generate constructors for you. Anonymous types take this even further, where the compiler will be able to infer a type entirely.
While these features don’t function exactly like those in VB, it seems that the C# has a mandate to make C# a more productive language to program in, something that VB has working toward for years.