# Wednesday, December 22, 2004

C# Versus Visual Basic .NET

I'm confused, I see 4 pros for c# followed by 3 cons against VB:

The differences between C# and Visual Basic .NET are mostly to suit different programmer's backgrounds. Unfortunately, there are some other differences. The following is a list (other than those that were mentioned when I discussed Microsoft's "going back") of some examples of the differences between C# and Visual Basic .NET:

  • C# warns you if a function is missing a return statement—This catches a few bugs automatically.

  • C# requires XML-tagged documentation to be written in the code—Seems to be a good idea to drag out the comments from the code and use it for different scenarios.

  • C# can switch to Unmanaged mode—This can easily be achieved in Visual Basic .NET by just calling a C# class that takes care of it. Still, I find it nice to have the same possibilities in both environments.

  • You can use Using() in C# to tell that an object should be automatically Dispose()ed when going out of scope—That is very handy, for example, for connection and file objects that you don't want to wait for being garbage collected.

To be fair, Visual Basic .NET has some advantages over C# too:

  • Visual Basic .NET differs Inherits from Implements—In C#, it's written in both cases with a colon.

  • The event syntax is simple in Visual Basic .NET—It's as clean and intuitive as in VB6. In C#, you have to take care of more by hand.

  • Visual Basic .NET is not case sensitive—This is a matter of taste, but I prefer non–case sensitive. Otherwise, there is always somebody that will have two methods in a single class named something like getData() and GetData().

[ Introduction to COM and .NET ]

Inherits and implements are so similar concepts, why not use :, yet when doing events the extra code is deemed a pain? When it gives more flexibility? And case sensitivity is a plus, not a minus, doesn't everyone know that yet?

#    Comments [1] |
Wednesday, December 22, 2004 1:53:26 PM (Eastern Standard Time, UTC-05:00)
Yes, but it is VB coders we're talking about here ... so you run the risk of some asshat using "VALUE", "Value" and "value" as three different things. ;)
Comments are closed.