A while ago there was quite the discussion about what the differences where between VB.NET and C# and what people should use.
After a while it seems that most things where said and it became clear that the C# camp had the most zealous advocates.
Now things have quieted down a lot and it would seem that most people have made their choice and perhaps even changed it in between.
At the time that I wrote my previous post about the subject the statistics where telling us that the usage was about equally divided between VB.NET and C#.
The state today
Today there is a different picture, most of the highly visible people who where actively supporting the VB.NET language have switched to C#.
That probably means that the usage of VB.NET has now dropped a great deal compared to C#.
Looking at job postings etc. it would also seem that C# has won the race.
Which is something which probably isn't that surprising.
A poll by Telerik shows: 69% C# vs 30% VB.NET.
Last year it was: 63% to 34%.
Why did C# win the race
- VB.NET got a bad name by being associated with VB6 and it's predecessors, which most wouldn't really consider a respectable language.
- C# Has a good name because of the fact that it's modeled by Andreas Helberg the creator of amongst others the Delphi language.
- C# has been modeled after more respectable look a like languages: Java / C / C++, which are all languages which are well respected.
- Because of the points above there are more job openings for C#.
- It seems like a lot less typing to get the same thing done.
- More and more projects are done in C# in comparison to VB.NET.
- C# pays more money.
- People migrating from VB6 sometimes choose C# instead of VB.NET because of a lot of the above reasons.
- Almost no people who migrate from Java / C++ are considering VB.NET as a language.
What is happening now
Things are getting worse for VB.NET.
My favorite .NET books (ASP.NET Unleashed) have gone from VB.NET to VB.NET + C# to C# only.
People who use to be prolific VB.NET programmers are also migrating.
What are the current differences in the languages
Taken from wikipedia:
Features of Visual Basic .NET not found in C#
- Variables can be declared using the
WithEvents construct. This construct is available so that a programmer may select an object from the Class Name drop down list and then select a method from the Declarations drop down list to have the Method signature automatically inserted
- Auto-wireup of events, VB.NET has the
Handles syntax for events
- Support for optional variables (this will also be available in C# beginning in version 4.0). This is typically used to provide easy interoperability with native code
- Marshalling an object for multiple actions using an unqualified dot reference. This is done using the
With ... End With structure
IsNumeric evaluates whether a string can be cast into a numeric value (the equivalent for C# requires using
- XML Literals
- Inline date declarations by using
Features of C# not found in Visual Basic .NET
- Allows blocks of unsafe code (like C++/CLI) via the
- Partial Interfaces
- Iterators and the
- Multi-line comments (note that the Visual Studio IDE supports multi-line commenting for Visual Basic .NET)
- Static classes (Classes which cannot contain any non-static members, although VB's Modules are essentially sealed static classes with additional semantics)
- Can use
unchecked contexts for fine-grained control of overflow/underflow checking
- Auto-Implemented Properties (as of C# 3.0)
- Implicitly Typed Arrays
Other characteristics of Visual Basic .NET not applicable to C#
- Conversion of Boolean value True to Integer may yield -1 or 1 depending on the conversion used
- Assigning and comparing variables uses the same token,
=. Whereas C# has separate tokens,
== for comparison and
= to assign a value.
- VB.NET is case-insensitive.
- Type checking is less strict by default. If the default is left in place, It will auto convert type without notifying programmer, for example:
Dim i As Integer = 1
Dim j As String = "1"
If i = j Then
It should be noted that changing this default (known as 'Option Strict') is widely considered best practice for VB development.
Other characteristics of C# not applicable to Visual Basic .NET
- By default, numeric operations are not checked. This results in slightly faster code, at the risk that numeric overflows will not be detected. However, the programmer can place arithmetic operations into a checked context to activate overflow checking.
- Addition and string concatenation use the same token, +. Whereas Visual Basic .NET has separate tokens, + for addition, and & for concatenation.
- In Visual Basic .NET property methods may take parameters
- C# is case-sensitive.
- C# does not allow optional parameters (this will be available in C# beginning in version 4.0).
The fight is over and C# won, not that VB.NET isn’t a valid option.
As you can see from my list I think that technical superiority isn’t the reason that C# is winning the race.
It still has my vote for a lot of things. But I don’t expect to be programming in VB.NET a lot in coming jobs.