none
What makes C# better than VB

    General discussion

  • 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

    Ayhan

    Monday, November 27, 2006 1:49 PM

All replies

  • Hello All.

    Ayhan:

    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!"

    HTH

    Monday, November 27, 2006 3:23 PM
  • Bravo Mark!
    Monday, November 27, 2006 4:14 PM
  • 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.

    Monday, November 27, 2006 5:32 PM
  • 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.

     

    Monday, November 27, 2006 5:45 PM
    Moderator
  • 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.

    Monday, November 27, 2006 7:03 PM
  • 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!!

     

    Monday, November 27, 2006 7:26 PM
  • 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.

    Monday, November 27, 2006 8:09 PM
  • 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.

    HTH

     

    Tuesday, November 28, 2006 11:45 PM
  • Hello All.

    Keith:

    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.

    HTH.

    Wednesday, November 29, 2006 12:05 PM
  • Ok, I will try to explain why I'm using C#.

    My answer will be simple what car do you want to have ? Aston Martin DB9 or Ford?

    C# is different from VB.NEt as these cars. If you need a car just go to store and drive a few minutes a day probably it doesn't matter what car you have.

    So if you are using programming for simple this without abtract models and your code is the same as our parents wrote on Pascal or Basic you do NOT need move to C#, you will have enough  work on VB . But if you want to use all 'FORCE' you must move.

    VB doesn't support complex models if you never worte on C++ or C# it hard to explain to you.

    Thursday, June 3, 2010 7:23 PM
  • C# is better because it has a sharp sign and VB doesn't have :-D

    I love C# ;-)

    Thursday, June 3, 2010 7:28 PM
  • CLR/ DLR it the same different only meaning, you cannot think on VB , that you can do on C#. Complex objects will be very ugly on VB. and it'll not be usable and readable.
    Thursday, June 3, 2010 7:29 PM
  • It's very subjective. Many C# devs look down on VB devs without realizing that several C++ devs treat them both the same!
    http://blog.voidnish.com
    Thursday, June 3, 2010 7:32 PM
    Moderator
  • VB is still alive becuase Bill Gates have been produced it. I think he have many memorabilia with it so far and he doesn't like to lose it ;)
    LEARN HOW WPF IS FLEXIBLE IN PRESENTATION DURING A QUICK SIMPLE WALKTHROUGH:
    Walkthrough: Displaying multi column ComboBox by using Windows Presentation Foundation (WPF) data templating
    Thursday, June 3, 2010 7:46 PM
  • They are all tools, designed for a specific task, you should use what is best for you.  I have worked with severals so people should be flexible.  Some people think new is best (like a toy) and are riding the bandwagon.  However as a person who has to see (and fix) a lot of code c# tends to create less abominable things that c++.  Also as the programmer has less control he can't create horrible and almost unfindable bugs and make a headache of everyone else lives

    Thursday, June 3, 2010 7:52 PM
  • I've written about half a million lines of VB and C# code since 2003, and while I find it slightly easier to write in C# (and find code examples on the Internet), the two languages can accomplish the same task. I think it pays in the long term to know both languages, because of employment opportunities. I got a big raise and am "large and in charge" on my current big VB.NET project. But I do miss programming in C#. VB is a bit clunkier, but conversely more verbose and easier to read. Supporting somebody else's C# code is harder because its cryptic & mathematical. I would also say that casting is totally out of control in C#. I am also suspicious that cryptic languages encourage inefficient algorithms. 

    Truth be told, the K.I.S.S. principle holds for production-worthy code. I don't care how clever the code is, or how easy it is to write. I care about how well it works (bug density), how easy it is to maintain and understand, and how efficiently it works. That has more to do with the programmer than the language itself. 

    BTW: I've researched is and C# programmers do not appear to make more money than VB.NET programmers. 

     

    Thursday, December 16, 2010 2:29 PM
  • C# code is harder because its cryptic & mathematical.

    I'm not sure we give the same meaning to the word "cryptic".

    I would also say that casting is totally out of control in C#.

    I don't understand what that means. Did you mean "in VB"?

    Thursday, December 16, 2010 3:57 PM
  • I wrote a blog post about some of this here:

    http://msmvps.com/blogs/deborahk/archive/2009/07/22/vb-or-c.aspx

    See the comments section for additional feature comparisons.


    www.insteptech.com ; msmvps.com/blogs/deborahk
    We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
    Thursday, December 16, 2010 4:32 PM
  • One other difference I've found is that when looking for jobs, a C# "position" seems to pay better than a VB.Net "position"

    Well, this is what I've found in the UK anyways...

    K

     

    Thursday, December 16, 2010 10:10 PM
  • Ok all you people.   I started in VB and have been doing C# for a little over a year and it seems that one thing C# programmers have a tendency to do is to make their code look as complex as possible.   What ever happened to the old KISS - Keep It Simple Stupid - methodology.   Reading C#, even after working in it, is like reading Chinese (if you don't know Chinese).   It is just NOT a business language.   It is meant more for scientific applications and NOT business applications.    It is not easily readable to the programmer who did NOT write it.   Too many C# programmers use cryptic variable names and I wonder if they know how to make a meaningful variable name. 

    Thanks but not thanks... I will do ALL my projects in VB.    At least they are readable and much faster to write.

    Thursday, October 24, 2013 8:01 PM
  • Sure was a great debate by HTH but a convincing one as well, Bryan! Besides much of it is just the psychological effect of the names of the two languages!

    C# isn't that SHARP enough while VB isn't BASIC enough to overtake each other ;)


    Best Regards, Faraz A Qureshi

    Monday, November 11, 2013 5:46 PM
  • Hello,

    Aside from syntax and some quirk things like pointers that unless you're dealing with COM and maybe critical sections of code that you absolutely must it optimized, nothing makes C# better.

    EDIT: Just to add a point that I find it important, over the years I realised that the more languages I learn the better I become at developing software because I can overcome limitations and solving problems in the software that I'm developing by being inspired by other languages, meaning, I can look how it was done or dealt with in a different language and then create a library that offers the same functionality in the language I'm using to write the software.

    I think that it's really wrong to ask what language is better because each was designed to perform something else or the same thing with a different approach to develop software, so the right question you should ask yourself is "what language I want to learn first?". :)


    Regards,

    Eyal Shilony


    Monday, November 11, 2013 9:50 PM
    Moderator
  • They both do the same thing and one can make either language be as complicated or non-complicated as he or she wants. It's been plenty of times with using both languages being a contractor and looking at someone else's coding I had to ask why is this crap application and the coding so complicated, because it was not necessary.

    I do think when you do see unnecessarily complicated code, it is due to a developer with his or her playtime that should have been stopped by someone on a code review.  

    Monday, November 11, 2013 10:27 PM


  • Ok all you people.   I started in VB and have been doing C# for a little over a year and it seems that one thing C# programmers have a tendency to do is to make their code look as complex as possible.  

    Rubbish, just because you don't understand something doesn't mean that the programmer was trying to make it as complex as possible.

    Generalizations are only made by inexperienced and/or narrow-minded people either because they can't see the whole picture or they do but don't understand anything from it.

    What ever happened to the old KISS - Keep It Simple Stupid - methodology.

    It's not a methodology, it's a principle.

    Reading C#, even after working in it, is like reading Chinese (if you don't know Chinese).

    So by that definition, you're saying that if you actually knew C# it wasn't like Chinese for you but crystal clear, like it is to most of us.

      It is meant more for scientific applications and NOT business applications.

    Wow, is that official? because as far as I heard C# just like VB.NET is a multi-paradigm kind of language.

    The syntax of a language (which obviously you don't like) doesn't dictate what the language can or can't do, it is used to express the logic in the program.

    It is not easily readable to the programmer who did NOT write it.

    Readability is something you can really manage in any language and nothing in VB.NET makes it more readable, it's verbose yes but who said it's readable? you?

    Too many C# programmers use cryptic variable names and I wonder if they know how to make a meaningful variable name. 

    So you're saying that it's possible to write readable software in C# it's just that in your experience you have seen enough so... you dropped C# because others were doing it wrong?? odd logic. 

    Thanks but not thanks... I will do ALL my projects in VB.    At least they are readable and much faster to write.

    If you find it better to your needs and you like it more then no one is stopping you from doing so but writing things that don't make sense doesn't really make you better, does it?

    I don't have any problem with your post as an opinion but you wrote it like it was the absolute truth that everyone should follow, in short generalization won't make you a better programmer (or software designer/engineer depends on your background) but the complete opposite.



    Regards,

    Eyal Shilony

    Tuesday, November 12, 2013 6:10 AM
    Moderator
  • It does not seem to me there is any real difference between them

    Simply, C# has been built for developers who are familiar with C and C++ but VB.NET has been built for programmers who are familiar with VB6 and Basic language.

    Microsoft tries to keep both of languages developers in its side by giving them new version of language

    Both can do the same job

    Wednesday, March 29, 2017 11:44 PM
  • You are not a VB developer for sure when you said VB code gave you headache. I never heard any VB programmer VB make code headache like you. VB always lengthy but  VB.net EASY able to read like human English language. The code look like a document but I like the way it is. we always need documents.  versus with C# with a lot of symbols ex: ? => sometime lambda, regex, pointer ... if you don't learn these symbols in your brain. you are going to unable to understand the code. 
    Friday, February 8, 2019 4:41 PM