Post permalink

It seems a lot of what you desire is in F#, why don't you use that instead? The type inference in the language is sublime.

let x = y
let apples = oranges

I now use the var keyword in C# like its running out of fashion. In visual basic you have

Dim anInt as Integer

which is far more elegant than

MyClass myClass = new MyClass();

Visual Basic 9 also has type inference.

In C# you can do:

var x = 42;

And in VB you can do:

Dim x = 42

In both cases the type is inferred to be an integer. However, VB will only do that if Option Infer is turned on (which I think is the default for new projects in VS2008); if Option Infer is off, it uses the old behaviour in which case x will be a late-bound Object
in the above example.

It also has the strange effect that in VB, the following three lines are now identical in meaning (with Option Infer On):