Which is best – C# or VB.NET?

Home » Advice for New Developers » C# » Which is best – C# or VB.NET?
Photograph of two people having an argument / strong debate

The C# vs VB.NET debate is as old as .NET itself, although thankfully appears to be calming down in recent years.

When I started using .NET over 10 years ago, I started with VB.NET because although I had 6 years C experience from a previous life, I was also experienced with VB6 and VBA, so it was a natural progression to get into VB.NET.

While its important to specialise, to focus in order to develop skills in particular areas, its also important to consider the best tool for a particular job, and most definitely not get involved in “religious” arguments, I bet a lot of which are fuelled by the developers concerned not knowing the other language very well (or their own main language if it comes to that) and also not wanting to somehow “lose” the investment in time they have made getting this far.

I have just browsed around the net looking for real information on the differences and most of what you read is just garbage. If a post starts with “I hate VB.NET” or “I hate C#”, for sure that person is unemployable in my eyes until they gain enough experience and perspective to be able to change their views in order to DO WHATEVER IS NECESSARY to produce the best possible system in all respects for their end user, irrespective of the technology required (I’ll bet a lot of people probably never get past this stage in their own personal development).

Screen shot of Visual Studio 2012 Error List

Aiming for zero warnings is a worthwhile aim

Having used .NET for over 10 years, probably C# 60%, VB.NET 40%, my specific views on the subject are as follows:

  1. C# became a standard outside of Microsoft in 2006. Wikipedia has some more information on this at http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29.
  2. By default the C# type system is better than VB.NET. If you use VB.NET make sure you turn option explicit on in the project settings along with option strict and ideally option infer as well. The benefit with option strict is that the compiler will pick up errors that otherwise would only detect at runtime, making VB.NET similar to C# in this respect. This is useful because type checking can be used to your advantage when writing or re-factoring code at compile time and it also helps produce errors and warnings (you are aiming for zero warnings aren’t you? If not seriously consider doing this as warnings can hide many larger errors).
  3. C# has some very succinct constructs, such as:var c = d ?? 0;andvar c = d as long?;
  4. More companies prefer C# to VB.NET, possibly for the above reasons and rates of pay are 15-25% higher for C#.

I’ll be blogging more about the features in future posts.
So I usually prefer C# if left to my own devices, but as related its important to remain impartial as well and to listen to other points of view, particularly your end users.

About Phil

I have been working as a software developer since 1983. This blog could have been called "From Fortran 77, C and Cobol to C# in 20 (not so) easy years", but it doesn't sound quite right somehow. Besides I'm talking about what's happened since 2003, not before!

Leave a Reply

Your email address will not be published.


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">




Top Posts & Pages

Categories

Recent Posts

Recent Comments

Archives

Blogroll

  • Mike Cohn's Blog
  • Scott Hanselman's Blog
- mike@mountaingoatsoftware.com

I wrote 25 blog posts during 2018. In case you missed some of them, here are the most popular. [...]

- mike@mountaingoatsoftware.com

The iterative and incremental nature of agile makes an agile approach seemingly less compatible with [...]

- mike@mountaingoatsoftware.com

Velocity can be great for predicting how much a team can deliver in a given period. But it needs to [...]

- mike@mountaingoatsoftware.com

Succeeding with agile isn’t just about knowing where to start, it’s about knowing where to go next—w [...]

- mike@mountaingoatsoftware.com

Here’s what to do when facing a complex user story that cannot be split but is too large for one spr [...]

- Scott Hanselman

As I said on social media today, it's 2019 and I'm updating the Firmware on a Zune, fight [...]

- Scott Hanselman

I'm going to try to finished my Relationship Hacks book in 2019. I've been sitting on it t [...]

- Scott Hanselman

My son and I were working on an Adafruit NeoTrellis M4 Mainboard over the holidays. This amazing lit [...]

- Scott Hanselman

I'm on vacation for the holidays and I'm finally getting some time to play video games. I [...]

- Scott Hanselman

I blogged about DOSBox five years ago! Apparently I get nostalgic around this time of year when I [...]

Meta