Programmer's Corner - C# vs. VB.Net – It’s Just Syntax!

Backup and Security Solutions 10% off all products with promo code: VISI-P1YR
Get the Programmer's Corner FireFox Search Plug-In

C# vs. VB.Net – It’s Just Syntax!

C# vs. VB.Net – It’s Just Syntax!



Since the .Net languages came out, there have been many holy wars between C# and VB.Net.

Which is better?
Which is more reliable?
Which pays more?
Which makes better coffee?

If you would have asked me that question last month, I would have said C# (for everything but the coffee… Java wins that round).

Ask me that question today, and you’ll get a different answer.

The (sorta) Conversion



I recently started working for a small log homes company. They have several projects written using Visual Basic.Net that I now maintain. I wanted to start using C#, since that was my choice in the holy wars. I would always tell someone (VB.Net works, but C# works better and pays better). I started researching the differences between the languages so I could present a proposal to my boss and convince him of his inferior ways and convert him to the truth.

Boy was I wrong…

After visiting several websites, I found one that gave me The Answer! Not the answer I originally thought I wanted, but the answer that I needed. This article talked about how both languages are built on the .NET framework. Both languages accomplish the same thing; they just use different syntax to do it.

It’s All About the Framework



If you’re a VB.NET developer and you know the framework, you can learn the syntax for C# in a week (after all, most of it is just braces and semi-colons, right?) And if you’re a C# developer, then you just have to stop using the semi-colons and braces.

In truth, there are more syntax differences between the languages. The Case statements are different, assignment and equality operators are different, and structure of classes and inheritance is different (to name a few). But those are syntax differences. Both languages will create email clients. Both can create dynamic websites, both will create network tools, command line utilities and fancy windows applications.

So, before you start jumping back on the holy war bandwagon, why not ask yourself this: Do you want to be a versatile developer who has a whole tool belt of tricks, or just a programmer who can bang out code in one language (or maybe two)?

Next time someone asks you which language you write in, you can tell them “VB.Net AND C#”. Why? Just remember this phrase:

If you know the framework, the rest is just syntax.

Author Information:

Eric D. Burdo

http://thenxtstep.blogspot.com/

Comments:

Add your comments here.

Name

Comment

You can also send feedback to feedback@programmers-corner.com


Bobby Strickland - January 26, 2006 9:32 PM

I 100% agree with you on this. I just wish that companies would understand this. Most of the companies prefer C# developers because they feel that its harder to learn and that the "hobbist developers" will flock to VB.Net. They seem to feel that they will get a better grade of programmer if they choose C# developers over vb.net developers.

My opinion is that the tool used to program should not be put above the programmer who uses the tool.


A Chinese Guy - February 17, 2006 12:09 AM

Good Article!


Mike Dot Net - March 15, 2006 12:38 PM

Great Article! Every C# and VB'er should read it prior to using VS2005!