Friday, April 16, 2010

Large Lump On Dogs Chest

VB - Quo Vadis?

Yes I admit I like VB.

I think VB10 has some very useful features. For example, in most cases, no underscores (_) is necessary as so-called Line continuations more.

are nice too, the collection initializer, it is currently not in C # in the form.

So far I liked VB always defend, when it came, if VB is worse than C #.

But now I begin to have doubts. This may be because I love C # but rather have won. But perhaps because I always write more F # code and its elegance simply stunning find.

The reason why I have any doubt about VB, VB10 following code I in a Blog've discovered.

Public Sub load policy detail ()

Dim client As New Services.Service1Client ()


AddHandler client.GetPolicyDetailCompleted,

Sub (s As Object, e As GetPolicyDetailCompletedEventArgs )

If e.Result \u0026lt;> Nothing Then

MessageBox.Show ("Awesome!")


End If End Sub



client.GetPolicyDetailAsync ()

End Sub


This code shows how to tie an anonymous method to an event. Here the same code in C #


void load policy detail ()

{


var client = new
Service1Client ();

client . GetPolicyDetailCompleted + = (s, e) => if (e .!.! "Awesome" Result = null ) MessageBox Show ( );


client.GetPolicyDetailAsync ()

}


This code is still clearly readable. Instead of 8 lines of code and a lot of "noise" I need only 3 lines of C #. Well you could have the code to format something, then you get to 5

I do not understand what benefits will bring a programming language for the same result is 3 times as much code needs to write.