tags:

views:

248

answers:

7

EDIT: duplicate of http://stackoverflow.com/questions/352882/why-is-there-such-a-large-percentage-of-c-questions

I couldn't help but notice that the tag topic count for C# is in excess of 8900 while the vb.net tag topic count is sitting at 1019. Does this mean that there is a shift towards c# as a .net language of choice, or perhaps the vb.net community already know it all and there is no need to ask any questions.

I am Not tying to start a war here. I am new to programming in ,net and the only reason I decided to build some applications for work using c# was that I like curly braces - after all vb has the same language support as c#, doesn't it so there should be no advantage to choosing one over the other; other than curly braces ;)

+2  A: 

I don't think it is a "shift" so much as a quite long established fact. I'm not judging one against the other, but I know a lot of people (myself included) deliberately moved away from VB (VB6 at the time) when moving to .NET.

With 4.0, the two get even closer in terms of unique features - the most notable (for me as a C# dev) being dynamic as an alternative to OPTION STRICT ON in VB (for COM work).

Other than that, they are largely interchangeable. I vastly prefer the style of C#, but that is just preference. There does, however, seem to be more of a market in C#.

Marc Gravell
A: 

I started my programming in VB4.. and have been a VB fan since. And then LINQ came along and LINQ syntax in C# is so much nicer than in VB.NET, so I switched.

And most people are either switching from a languages with curly braces such as Java and/or C/C++ so it's only natural that they pick C# over VB.NET

And language support is not entirely 'the same' i.e.:

  • My Extensions is very handy for some tasks.

  • VB has late-binding support (COM, ActiveX, Javascript etc.)

  • VB needs an underscore for line continuation which makes spanning LINQ queries to multiline a little hard to type and rearrange.

  • C# has full anonymous method support while VB is only limited to single-expression lambda function only.

  • You cannot use unsafe code in VB, so a performance-critical application might be better off with C#

  • VB has the Handles and With statement and method-scope static variable which is handy at times.

  • VB has XML-literal syntax which is super-useful when creating XML-laden apps.

  • And with type inference, it's becomes so much easier to program in C# especially for folks who like functional programming. I used to hate having to declare the type I want twice when instantiating a variable in C# but that has been solved with var.

.

// Can your language do this?
Dim xmlSnippet =
    <someXml>
        <someNode><%= localVariableHere %></someNode>
        <%= For item In dataset _
            Select <subNode><%= item %></subNode>%>
    </someXml>

.

Dim x As New MyClass("Params")     // read like an english sentence but...

MyClass x = new MyClass("Params"); // who says C is shorter than VB?

var x = new MyClass("Params");     // equal, but there're more punctuations!

In the (near) future, .NET 4.0 will brings changes that will smooth those differences, particularly VB getting multiple-statement delegates and C# getting late-binding support.

So there might be more people taking up VB when .NET 4.0 comes. But for now, the stats say it best.

chakrit
VB's late binding gets converted into reflection code behind the scenes, otherwise you have to write the reflection explicitly when using Option Strict. And the latest version of VB.NET is going to allow underscores to be omitted after certain lines, making it code a little easier to read.
Juliet
@Princess we'll have to wait until .NET 4.0 comes and ISV started developing new projects on it. But until then, we're stuck with what is available in 3.5
chakrit
+4  A: 

Jeff had an interesting blog article about this, asserting that basically, people either keep developing in VB6, or are switching right to C#.

The change between VB6 and VB.Net is so big and the differences between VB.Net and C# so small that most people apparently decide they might as well use Microsoft's "default" language for .Net - and there is a big advantage in doing so, since it's better supported by tools, libraries, etc.

Michael Borgwardt
Yes I read that article...it was very interesting. At work there are other people desiging in house applications using several different methods msaccess,vb.net,vb5 and c# it's very frustrating.
Brad
A: 

Coming from mostly C++ programming (with a little Ruby and Matlab) to my current job, which is a .NET shop, I have programmed in both VBA and C#. My preference is C# as 1) I find I make more errors in VB with minor spelling mistakes that are treated as valid untyped variables and not pointed out by the IDE and 2) C# has many more examples of use on the net than C++ for learning language features and interfaces to things such as GUI toolkits. Thus, from both the top and the bottom C# is a workable compromise

+1  A: 

8900 vs 1019 could it mean C# programmers get stuck more often than VB programmers?

MBoy
+1  A: 

It's not language based I think.

I saw this in my 2 previous jobs : C# developers are often more enthousiasts than VB developers.

I think that this is because C# developers often have a different background. You don't learn VB in computer science in hight schools...

Sylvain
+1  A: 

I started out as a basic programmer, when I started .net I used vb.net now I use C# because I find it requires less typing and in general there is more support for C# over vb.net especially for advanced frameworks and n-tier application architectures.

I think .net is a great way for basic programmers to switch to a C style language because C# is so similar. (if they want to that is, there is nothing wrong with basic styled languages IMO)

Element