What makes C# better than VB  
Author Message
Ayhan Yerli (TR-NL)

PostPosted: Visual C# General, What makes C# better than VB Top

hey friends,

I am a Visual basic developer. I hear that every C# programmer says C# is better - stronger than VB . But when I ask the reason I can never have a strong answer :) . Is there some body can tell me the benefits of using C# rather than VB. What makes is stronger than VB I want to learn C# but I want to be convinced before I start ..

Thanks a lot


Visual C#20  
Mark Benningfield

PostPosted: Visual C# General, What makes C# better than VB Top

Hello All.


Well now, it looks like we have a philosophical discussion on our hands. So, here's my philosophy, FWIW.

I really don't think that there is a dime's worth of difference as far as "strength" goes, whatever that is supposed to mean. Whatever you can do in C#, you can do in VB. Now, for the sake of discussion, let's assume from the outset that we are talking about the .NET 2.0 versions of both languages. Assuming that they make the same BCL calls, they both compile to the same MSIL. One of the fundamental features about .NET is that the CLR doesn't care a whit about which language the source code is written in.

I think the debate all boils down to coding and development style preferences. When I started programming for Windows, I coded against the Win32 API, which is by far easiest to do (but still not easy ) with a C-based language. So, naturally, I gravitated to C# from C++. Which, by the way, MS made very easy to do.

In comparison, I think that on the one hand, you have folks who are of the opinion that since VB is a "Basic" language, that it is not as "professional" or "real" as C#. To which my answer is, "Well, if you write code that sells, it is as "professional" or "real" as it needs to be." Add to that the fact that the MSIL is identical to C# code, then from the execution standpoint, there is no difference at all.

On the other hand, you have folks who either say that VB is too verbose, or C# is too cryptic. Again, we're talking about the source code, not the binary, so it's really a style preference. The old supposed trade-off between efficiency and readability. But, with modern optimizing compilers, most of the time, if you try to get cute with efficiency, you wind up shooting yourself in the foot. Besides, the author of the code is the primary contributing factor to code readability. As far as who considers what to be "readable", again, a lot of the time it's merely a preference.

In addition, there are several instances of things being much easier to do and more concise in VB than in C#, like the methods in the .Strings module, for example.

As to whether or not you should learn C#, I say "By all means, do so." You said yourself that you wanted to, so go ahead and do it. It certainly won't hurt your resume. You say that you want to be convinced that C# is "better" than VB. Well, I am positively convinced that Brussels sprouts are disgusting. So, convince yourself.

The main point that I'm trying to make is that I think one should concentrate on writing clean, efficient, readable, maintainable code -- that works. Personally, I think that arguing over whether or not C# or VB is the "better" or "stronger" language is like a bunch of firemen at a fire arguing over the color of their fire trucks. I say, "Just pick up a hose and start pumping water!"



PostPosted: Visual C# General, What makes C# better than VB Top

Bravo Mark!


PostPosted: Visual C# General, What makes C# better than VB Top

Mark is right on.

I was a VB6 coder who switched to VB Net....

After a couple of weeks of reading posts that pretty much said what Mark did....I thought...well, if Im just learning "syntax" differences..why not learn something new. So C# it was. If you can code in VB or VB Net...C# will be very easy for you.

C# just seems...well, readable and easier to get around in... VB Net code now gives me a headache.


PostPosted: Visual C# General, What makes C# better than VB Top

lol this is going to become a flame war but being a moderator - lets not get to this! :-)

basically, the difference being that its quicker in syntax and more professional and does not do "shotcuts" like VB.NET does, such as converting int to a string.

its an industry standard language as well and is a developers dream language, and a good progression onwards in your development career. Microsoft use C# for their projects (internal and external - can't say more than that) and so do many other people. C# was the language that created thousands and thousands of jobs around the globe, apart from the .NET platform itself. Sure, you can do the same thing in C# as in VB.NET or the other way around due to the fact that its using the same platform/CLR and its just giving us developers more choice to use the platform by giving is a range of languages to develop in that suits our needs and thats a big win.


PostPosted: Visual C# General, What makes C# better than VB Top

I was a VB developer for 4 years. When C# arrived i switch immediatly.
I see VB as a Windows XP but the first version. On top of it a service pack 1, and on top of it Service pack 2. So you have a XP with sp2. It is the same as clean XP with SP2 included. So what is the difference There is no difference, but we feel that they are not the same.
What i have saw until now is that when you have a bagaage like VB does, almost always i saw old VB functions VB.NET projects, not .Net, and that scares me.
There are many reasons why i switched from VB. If you are at decision with what to start programming, definitely C#.
If you don't find any good reason for that, think with money reason. C# is more respectfull and more payed then VB. C# developers are more needed than VB devs.

Microsoft will not tell you 'for now' please choose C# instead of VB. But if you watch webcasts or msdn tv or any public event, 90% of all that present some code for examples, it is in C#. Every one of us can translate this in a different way, but my conclusion of that is clear and you know what it is.

Ayhan Yerli

PostPosted: Visual C# General, What makes C# better than VB Top

Thank You all...

It is fun :-) And you know what I'm convinced now... Not because of a particular answer but all, Again, Thank you all... I'm working on a project now and very busy with that. After I finish the project  I  will actively start to code in C#, and you will have a lot of headache because of my silly questions :P

Have Fun!!



PostPosted: Visual C# General, What makes C# better than VB Top

Here is the best reason to learn C# over VB.NET.

If you ever decide to jump off the Microsoft development technologies, you will probably be forced into a JAVA environment. C# is Microsoft's equivalent to JAVA and the syntax between the two systems is nearly identical.

Keith Rome

PostPosted: Visual C# General, What makes C# better than VB Top

There are actually some differences between the two languages. It is not merely a matter of style preferences. As someone fluent in both, I can say that neither is "better" than the other, just that each has it's strong and weak points and might be better suited to a given task depending on the requirements at hand.

Some of the differences that come to mind:

VB can perform late-binding of COM/ActiveX objects using IDispatch, C# cannot. Well - it can, but not anything nearly as easy as VB. This is huge issue if you are doing a lot of MS Office integration (heavy use of late binding object activation).

C# supports customized event accessors. You can provide your own add/remove accessors for event properties in C# - cant do this at all in VB as far as I know. This can be a big deal when building complex server components that need to support a large number of events (but those events are rarely used). This allows C# components to optimize empty event handler storage, whereas VB components must always reserve memory for them.

Arrays behave "oddly" in VB when using the standard array sizing verbs. To make VB.NET more comfortable for VB6 developers, arrays in VB.NET are 1-based. But in reality, they are 0-based, only they *look* as though they are 1-based. VB sneaks an extra null into position 0. This can make life a complete nightmare if you have to consume an assembly created in VB that exports arrays in a project that uses C#.

There are some other significant differences that classify as beyond "style preference", but these are the big three to me.


Mark Benningfield

PostPosted: Visual C# General, What makes C# better than VB Top

Hello All.


Yes, of course the languages are different. The preferences I'm talking about are those of the developer. The language itself can't have a preference. It's a question of whether you prefer to use a language that makes it easy to use late binding on COM, because that's what you want to accomplish, or one that doesn't, because late binding is not important to your goal.

Ditto for the other two differences you mentioned. One of the many things I like about .NET is that you can now use the differences between several languages to your advantage, all at the same time, on the same project.