Sdílet prostřednictvím


To VB or not to VB: VB.NET or C# -- which one should you choose?

I get asked pretty often which of these two languages I prefer.  I prefer C#.  But which one should you choose?  That depends.

*  If you have lots of legacy VB code, VB.NET may be a better choice.  VB.NET is a full-featured language and rivals C# in features and productivity.  They both derive their features and personalities from the CLR, so it's no surprise that most of the differences between them are more syntactical than semantical.

*  If you are coming to managed code from C or C++, by all means give C# a try first.  It's really just another language in the C family, and you'll be right at home in no time.

*  If you are new to coding in general or have no previous exposure to either C/C++ or VB.NET, I'd say it's a toss-up.  Which one you should go with really comes down to your individual skills and tastes.  As for C#, the fact that it's case-sensitive is about the only thing I can think of that might trip up a newbie trying to get up to speed with the language.  I find C# to be, in general, a more elegant language that is simpler to learn and simpler to use, but there are plenty of folk who don't feel that way.  For me, the ease-of-use chasm that used to exist between the VB family of languages and the C family vanished with the advent of C#, but other people still find VB.NET code easier to read than any flavor of C, including C#. 

*  If you have a mix of the above conditions, you might end up using both.  That's no crime, and is a perfectly reasonable thing to do given the right circumstances.  You can inherit from/use a class created in one language in the other (actually in _any_ managed code app), and, in fact, you're probably already doing that every time you build a VB.NET app because it uses classes in the Framework that were likely written in C#.

So, I won't presume to tell you what's best for you.  I'll just say that each language has its place, and which one you go with depends on your specific circumstances.

Comments

  • Anonymous
    May 09, 2005
    Thank you very much, as you realy helped me make my mind. I am new to both and struggling to decide which one should i go for. AND HERE IT IS, I decided to take your joice of c# and realy i was in a mess as my mind say VB.NET and my feeling say C# as I realy feel even better after i took "Beggining C# Objects" and couldn't stop till chapter 3 so many thanks.

    Other thing which i think may help other people who struggling to decide as I been, I think C# will be the most powerfull language in the coming future and more people will be migrating to C# specially if .NET become avaliable on linux and other platforms.
  • Anonymous
    May 11, 2005
    I use C and VB before,but use C# now.
  • Anonymous
    May 11, 2005
    Re Post At : http://www.yeyan.cn/Programming/VBNETCsharpCpp.aspx
  • Anonymous
    April 04, 2006
    The comment has been removed