Home

VB vs. C#

June 12, 2012

The two big languages in .NET desktop development are VB.NET and C#. Both derive from long-lived and popular language families, and both have had their share of mutual dislike. Not dissimilar to the Capulets and the Montagues. C# has a proud history of hard-core development. It wasn’t that long ago that practically all serious desktop applications for Windows were written in C or C++. Visual Basic on the other hand has always been the softer language, aimed at non-professional programmers.

In the .NET framework the two languages have converged to an uncanny degree. The only real difference between them now is the ability to write unsafe code in C#, which you really oughtn’t be doing in the first place. But functionality isn’t everything. VB and C# were (are?) developed by different teams and they’ve come up with different approaches to similar problems. These differences have become fodder in the up-close war between Basic and C proponents, who now find themselves in uncomfortable proximity to the opposition.

Microsoft itself seems to be pushing C# harder than VB, for whatever reasons. But as my old* boss Andy leBihan pointed out, new programmers will always gravitate more towards VB, simply because it’s called Visual Basic, rather than C Sharp.

I’m not going to argue a position here, I’m happy working with both languages and I try to distribute new projects evenly between them. I started out as a VB programmer (VBScript, then VB5, then VB6, ultimately VB.NET 2005 → 2010) but have been working with C++ and C# for about 6 years now. There are plenty of things I think VB does better and plenty of other things that C# does better. Some of these are intrinsic to the language, others are mere implementation details of the VisualStudio code editor. Here follows a non-exhaustive list:

Read the rest of this entry »