a companion discussion area for blog.codinghorror.com

VB vs. C# -- FIGHT!


For what its worth, I have to say this: eventually Microsoft will give up on C# or VB, the question being: which one?

Think about this: you’re making an application. You have a large market for it and its going well. You ship it, and you get an e-mail with the following title:

“It won’t run on Mac?”

Some will hate me for bringing up PC vs. Mac, but I really don’t care. The point is this: how can you do well on 1 application with 2 platforms? You have to transfer the code to a new compiler, re-compile it, re-ship it… Its the same dellima Microsoft faces with Visual Studio. How can several languages be great if you have to focus on all of them and spread the greatness around?

VB and C# are so similar that you could throw one in the toilet and the world would work as before. Same .NET framework, nearly-same IDE… and the list goes on. If Microsoft was smart(er), they’d announce they’d can one lanugage and focus more on the other.

A lot of people would be mad, but really, programming is like riding a bike: when you learn to ride a street bike, a mountain bike becomes easier. Come on, VB developers, isn’t there something you like about C#, and vice versa? Why combine them and make everybody mad when you can eliminate one and make half of the people mad?

Think about it,


not long ago, i already gave up on programming… trying so hard studying every language that becomes currently in demand. since the early 80s, i tried my hand on quite a handful like basic, fortran, cobol, pascal, c, clipper, delphi, vb6, etc… and later on finding out what i learned is already passe… it was so frustrating trying to keep up with technology advancing so fast…
after several years of not coding now i’m back. what gave the motivation to go back into coding is the fact that most of todays programming languages, is based in c language. c is the language newer languages are being modelled from… in fact even most compilers and IDEs are developed using c. it’s clear to see… c is gonna be here for a lot long perhaps it’s here to stay forever. this made me conclude that if i’m going to focus on a programming language it’s gonna be c. and so i decided i’m gonna take the c# path. this will give me the clear advantage of being familiar with other “c like languages” as well like java, c++, php and javascript.


This is more aimed at people who are trying to decide which language to learn first:

I just recently started getting more into .NET coding.

When I looked at learning .NET, I chose VB.NET, because I used to use VB6 a long time ago, and I initially assumed that it would be somewhat backwards compatable and very familiar (this of course is not a good assumption).

I already know C, C++, and Java very well, and in fact, I do most of my work in those languages. So, looking back, I probably could have as easily chosen C# to start with.

I don’t see any really big advantages to C#, except for the fact that there are more code snippets online, so if you have a specific problem that you’re trying to find a solution to, you’re more likely to find the answer in C# than VB.NET. This isn’t a big deal, since it’s usually pretty easy to translate, but you can’t just copy & paste the code to see how it works.

It’s hard to say which language I would recommend to a beginning programmer who didn’t know VB or a C-flavored language.

I would however warn against the assumption that learning C# will make it easier to learn C or C++. I teach programming classes, and one of the things I find is that beginners often get confused when they learn a second language that has a very similar syntax but is fundamentally different.

This is true even of teaching C to someone who has been exposed to C++. If you’re going to learn multiple C-flavored languages, it’s always best to start with the one that is the most restrictive (which is C itself), then learn some C++, then learn C# and/or Java.

In some ways it’s better if two very different languages have very different syntaxes, because that forces a mental separation in your head, particularly for someone who is inexperienced. VB looks so different from C that no one is going to assume that whatever they do in VB will work the same in C.

I’m not sure that the argument that VB is a more verbose language holds much water in an OO programming environment. The C syntax was designed to make it easy to write large blocks of code in very compact form. The readability to an outsider is not as important as the coder being able to see all the code for his own function on one screen. Having case sensitivity also contributes to code compactness, because it makes it easier to use shorter variable names.

C is not the most compact language out there. You can write even more compact code in LISP and other functional languages, but C is probably the most compact procedural language that anyone uses.

However, the OO programming ethos, dating back to Smalltalk, is that you shouldn’t have to write these large blocks of code to begin with. If you subscribe to this philosophy, then verbosity is not a big deal and VB is certainly not the most verbose language out there (although one might argue that VB’s verbosity has little advantage).

I do find myself often writing large blocks of code that are hard to refactor in a more OO way, so C/C++ is more appropriate for that.


@ Mark,
Well not for me, i have studied both gw basic and turbo c a long while back… but looking at both visual basic and c# codes when i was trying to pick which one to study now that i’m making a come back, i can pick up c# easier at first glance… and to think i was trying out vb6 only a couple of years ago… i do pickup javascript and java codes as well when i look at them… My brain just wouldn’t let basic syntax and stuff just sink in unlike how easy c does. Maybe something inside me is resisting basic or something :slight_smile:
But then maybe since there are different types of programmers each one has their own preferred language depending on their particular style.
something like a round peg for round hole and square peg for square hole. if i am a round peg then there surely are a lot of pegs around just like myself.
Proof??? see the following:
* Telerik Survey 2008 suggested that C# (63%) had surpassed VB.NET (34%) as the primary programming language.
* According to a survey conducted by Visual Studio Magazine (a VB-“CENTRIC” publication) “41 percent said they used C#, 34 percent programmed in VB.NET, while 25 percent responded with ‘other.’”
* Stephen Wiley, marketing product manager at Apress has reported “C# titles outsell VB.NET title books handily, by somewhere between a 2–1 and 3–1 margin.”
* MSDN Blogs, the blogging site for Microsoft employees, has 27,500 posts that discuss C#, while only 8,880 mention VB.Net
* Google Groups, a Usenet search engine, returns 36,900 hits for “VB .Net”, and 65,700 for C#
* Amazon.com returns 9,923 hits for C#, and 2,149 hits for “Visual Basic .Net”.



My C++ prof would roll over in his grave…
public void foo(string arg)
if (null == arg) return;
// code here

I use VB, out of preference for the language syntax, mainly, but even in VB, I would do this, rather than using break statements. To me, a lack of break statements is a non-issue, since they’re generally considered to not be good practice.

public sub foo(byval arg as string)
if not arg is Nothing then
end if
end sub


Wow, that real-time converter works great.

I would like to make a couple of points:

"Case sensitivity is Just Wrong. I cry for a world where “Jeff != jeff”. "

Well, look at it this way. If you’re comparing strings in an application, should Jeff be equal to jeff?

“I’ve worked on several C# classes where public variables are named Var1 and private variables are named var1? Yeah, that’s not confusing at all… :P”

Stupid naming conventions don’t have anything to do with the language you’re working in. Just look at Hungarian notation ;). I’ve seen idiotic naming conventions used in VB as well as C#.

" Lack of background compilation. It’s more productive, period."

If this is something keeping you in VB world*, then definitely invest or ask your company to invest in Resharper. I’ve been using it for the last couple of months, and it’s great.

*VB world - where Functions don’t HAVE to have a return value.


I think anyone who takes a side on this is a nutter(some more than others!! Some hilarious, passionate comments on this thread!!). My policy is that the language of choice is based on what suits the job, its a tool after all.

I hire developers who can code well in both, if they can’t then they are not good enough in my opinion.

One observation I have made over the years is that its generally C# people who have the most hate (passion) going on. Not sure why that is but its all quite amusing anyway :slight_smile:

My background (before .NET) is Classic ASP VBScript and since .NET 1.0 came about I’ve used both a hell of a lot. I wouldnt say one is faster to work with than the other or do I feel like one takes more effort than the other. Its all good.


while I agree that fighting over the different languages does get silly, I like to think in terms of usability for the developers to decide which language syntax is better.

I’ve written enough code in enough languages to have learned that brace structures are far superior to keyword based start/stop blocks.

If I need to modify a for loop to be a while loop, I just need to tweak my opening statement, I never need to find the matching “end foreach” and convert it to “end while”.

Creating 1 line if/for/while/else/try/catch/finally blocks is a piece of cake with braces, yet still highly readable.

Code editors can easily syntax highlight, show matching braces, indent blocks, and apply code folding without having to know anything about the language.

Finally, since I consider closing brace commenting to be the No.1 anti-pattern:

}//end for

The whole idea of using these keywords as the default structure for the language makes me shudder every time I look at the code.


Almost every time I am forced to solve a problem in something other than .net C#/Mono I learn to love C#/Mono a little bit more.

My motto: If it’s simpler, it’s better.


After reading a lot of these posts and realizing that my comment is a drop in the ocean, I decided to proceed anyway. The #1 thing that drives me crazy about a language is being restricted. I started programming in Locomotive BASIC, then GW Basic, then Q Basic, then VB5/6, and at some point I started coding in Assembly language. It was really like a breath of fresh air compared to most languages. I began to use Call Absolute in Q Basic because I wanted the performance of assembler. Immediately in VB5/6 I also wanted the performance and freedom, so I’d compile NASM libs and link to it in VB, then run it. I really like C syntax, and I especially liked inline assembler features of some C languages, such as Turbo C/C++.

But when I ran into the elitist C++ MFC libraries I couldn’t tolerate them. The use of nuance typecasting the same Int32 as hundreds if not thousands of different things was driving me insane. It made me long for assembler because it was simpler! I also learned Java at some point and I liked it, but I also found it too verbose. C# hit the sweet spot between nice looking syntax and “just getting it done”. Compare C# to Python and Python can get things done in a fraction of the code. I’ve invested too much into the .NET framework though, so I continue to use it primarily to this day (millions of lines of code will lock you in after a point).

Anyway, point being, I was a huge BASIC fan, and I can’t stand VB.NET/BASIC after coding C based languages for many years. It’s way too much work to type and read comparatively. The thing that I like about C# is that it has access to everything .NET/CLR can do. Using the unsafe marker and pointers can get me pretty close to assembler performance for most things. Obviously I wish I could use inline IL assembler in my C# code, but I can at least tolerate pointer manipulation performance in most cases - even image processing and parsers. (which believe it or not, I use fairly often even with ASP.NET)

I realize that I’m kind of radical in terms of today’s business needs when it comes to programming. To me an ideal language lets me open the computer to do anything I want, but is also fast to type and easy to ready. I think understanding how a computer actually works is increasingly a lost art, and at the same time with scalability in cloud architectures it becomes increasingly irrelevant for many applications. I would say for programmers who are most interested in maximizing what you can do with .NET, C# will bring you closer. C++ will bring you even closer, but after looking at the syntax for C++ in .NET, it looks really messy IMO. (and I say that as someone who has written fractal landscape generators in pure assembler)

So, overall the sweet spot in my mind is C#. I’ve programmed in over 3 dozen languages and written several of my own languages and compilers over the years. This doesn’t mean my opinion is better than anyone else, but I do tend to agree that if you can code C#, you can probably code a couple dozen other similar C like syntax languages with less head banging into the wall. I don’t think it’s so much elitism as speaking a more universal language that will give you the tools to program microcontrollers, operating systems, compilers - basically anything. At the end of the day C# is modeled after general purpose languages while VB is modeled after BASIC which is intended for beginners. That isn’t a preference - it’s just reality. Despite C# and VB being 95% identical in capability with .NET, it comes down to the motivations behind their design, like any tools.

I also disagree with VB being easier to read or write - sure it uses words, but that just means I have to remember all the variations of words VB uses vs. a single set of brackets like C variant languages. For / Each / Next / Do / Loop / While / Wend / Begin / End / Sub / etc. vs. applying scope, procedures, properties, loops, etc. merely using { }. It’s also simply less reading and writing of course, as others have pointed out.

I really dislike elitism, which is why I choose C# - it is very oriented on just “getting things done” while still maximizing options with the CLR and being similar to many other languages. If anything VB is more elite in that it is a flavor all its own that wont help your fluency with a wide variety of extremely popular languages. Those are my 2 cents as someone with a large spectrum of experience who programs mostly for the love machines.