I can do in 2 lines of C# code what take 4 lines of VB.NET

I program in .NET. It is unavoidable, at some point you will be asked about C# vs. VB.NET. Personally I could care less. I prefer C#. I’m not even sure why. I grew up BASIC (Atari Basic, Amiga Basic, GW-Basic and QBasic). Later I switched to curly braces for high school (C) and college(C++). Along the way I used a number of langauges which also use semicolons and curly braces (php, perl, and pike). So I definitely became a curly brace kind of guy. Even though I did use Visual Basic, Visual Basic for Applications, and VBScript over the same time period, I simply felt more at home in C or C++.

So, next time some VB.NET lover tries to make an argument for VB.NET over C#, I’ll be ready. I’d give an example here, but I can never understand these arguments or even the underlying statements. They are usually so nonsensical. I rarely remember things that I don’t undersand, so I’m lucky enough that their convoluted arguments go in one ear and right out the other. Next time I am ready! I guess I shall try to remember this retort from
http://worldofcoding.blogspot.com/2006/11/numericupdown-is-nice-control-eh.html

[C#]
foreach ( Control c in numericUpDown1.Controls )
tooltip.SetToolTip( c, “mytooltip” );

[Visual Basic]
Dim c As Control
For Each c In numericUpDown1.Controls
tooltip.SetToolTip(c, “mytooltip”)
Next

4 lines of VB.NET equals 2 lines of C#!

I feel much the same about the old csh vs. sh vs ksh. I just don’t care. But I don’t have any good examples for why I prefer bash.

1 thought on “I can do in 2 lines of C# code what take 4 lines of VB.NET”

  1. Can do in 2 lines of C# code what take 3 lines of VB.NET:

    For Each c as Control in numericUpDown1.Controls
    tooltip.SetToolTip(c, “mytooltip”)
    Next

    Good programming isn’t a matter of language and LOC. It’s style what counts.

    Have fun !

Comments are closed.