C# or VB ?

other than familiar syntax

is there any reason to use
VB instead of C#

is the difference only syntax





Answer this question

C# or VB ?

  • Koson Thambundit

    yes

    but I think VB support optional parameter and not C#



  • Igor Z

    I program in both, although I started in vb.net because I had previously used vb6. A customer of mine insisted that a project be done in c#, which started my c# learning curve. There basically is little difference, but now that I am comfortable with both, I use both in my projects. VB is faster to market for database and GUI apps. C# is stronger in serial communications.
  • SIVAM

    what about job opportunities

    and $/hr differences




  • Ecko

    Its not. Both languages use the same framework and are compiled to the same il code. The primary difference is syntactical, with some very minor differences in functionality. To say that one language is better at implementing a particular technology is meaningless; they both use the .NET framework classes in exactly the same way.

    Personally I use both, which was easy since I had both C++ and VB backgrounds before moving to .NET. I would advocate learning both, as once you have learned one, learning the other is extremely simple. And knowing both makes you more valuable, and opens up more opportunities.

    As far as which to start with, its totally up to personal preference. Before .NET, I would have said that beginning programmers should learn VB first and then C++. Now, I dont think it makes any difference whether you start with C# or VB.NET.


  • ragrawal

    the c# IDE is much much MUCH more robust. There is absolutely no argument here!

    Also, take a look at the c# 3.0 roadmap. Many neat features coming. Yeah they might be implemented in VB.Net 9, but there is no guarantee.

    As far as optional parameters, arguments can be made for and against them.

    If you like typing such unnecessary things as "AddHandler/AdddressOf" and the hi-jacked "Is/As" operators - and many other totaly stupid key words as "Must Inherit/Must Override" as opposed to "abstract" or "Not inhertitable" which should be "sealed" or "Shared" which should be "static" - and you like the bassackwards casting functions, by all means, choose VB.



  • Ravi Sankar Samanthapudi

     

    For the last couple of weeks I've seen all these statements about what VB doesn't do.

    What they have really amounted to, were statements from people who didn't know how to impliment something in vb.



  • Beth Massi - MSFT

    Hi

    Ever since .NET arrived this question has stirred emotions between those developing in VB and those developing in C# (needlsessly so in my opinion). You often find the usual ramblings that C# is better than VB which I guess stems from when VB classic was an interpreted language against C++ which was a compiled language.

    Prior to the release of VS 2005 there were things that you could do in C# that you couldn't do in VB such as operator overloading, XML comments (although this can be achieved using third party tools) and 'continue' statements. But there were also some things that VB could do that C# couldn't such as the use of "With - End With" statements. I believe that some said that C# was also faster than VB which may be true in some cases but I find it hard to believe that performance would be that different considering that both languages are creating managed code against the same framework.

    With the release of VS 2005 however, VB now has operator overloading, XML comments and the 'continue' statement. So I would go out on a limb and say, choose the language that feels best for you without worrying about which one is better. Even better would be to get a feel for both syntaxes as a lot of code samples out there is only available in one or the other language so an understanding (even basic) will be of big help.

    HTH


  • utomhusgrill

    I personally program in both, and I strongly reccomend that you learn both. I use VB.NET at work, and C# on my home personal projects, in order to stay sharp with both.

    You are correct, the differences are largely syntactical. Both languages (all .NET languages in fact) end up going through the CLR, which is why no language is faster then another, and why they all have the same basic abilities.

    For most people, VB is easier to learn, and to read. You often have less code to write as a VB programmer as well. That has always been VB's strength.

    C# is more popular (in my opinion, just an observation) however, so you'll see a lot of examples and support for C#. C# gives you a little more granular control over your code in general. And new technologies tend to appear in C# before they do in VB. I can also tell you, as someone who is looking for a new developer position, that employers are demanding C# WAY more than VB.

    Anyway, don't listen to the snobs on either side of the fence. Learn whichever one sounds more interesting to you, and better yet, learn both.



  • SeemaG

    so, which does he say to choose

  • Shahzad Ahmed

    The biggest problem comes from trying to recognize these characters from the comport.
  • parcalto

    I have never worked with serial communications and don't know much about them. However, if you are inserting a "\n" or an "\r" in a string from C#, then you can insert a vbCr, vbLf, or vbCrLf in the same place in VB.

    ie: Dim s As String = "This is line one" & vbCrLf & "And this is line two."



  • HarryS

    "C# is stronger in serial communications."

    how is this true
    with only differences in syntax


  • Wilke Jansoone

    I'm having to deal with this issue right now. vb doesn't do carriage returns or nulls very well, while c# allows you to use \r \n or \0. If you know how vb deals with this issue in serial communications, I would appreciate learning more.
  • Adam Willden

    If you can program C# you can program VB and visa versa: the differences are really syntactical (which is just personal preferance), with both C# and VB having a [very] few functional capabilites the other can't do in an equivalent fashion. VB uses more keywords, and C# uses the esoteric C style - personal preferences.

    If you come from a C or C++ background, use C#. If you come from VB or any VBA applications (e.g. Microsoft Office) then choose VB; but that's not a hard and fast rule.

    If you work with a team, and you can go either way, then concentrate on the language the team uses. Even so, If you can program one, you can program the other: syntactical preferences aside. You are really programming the .NET framework, and that's where the work lies.

    Dan Appleman has a good e-book: Visual Basic .NET or C#: Which to Choose

    http://www.desaware.com/products/books/net/vborc/index.aspx

    Regardless, there are minor differences but definately no showstoppers (in actual fact, VB Classic programmers have been competing head-to-head with C++ programmers for years, even though it was considered a 'toy'/crippled language).

    As far as compensation goes, if you can find a company foolish enough to believe that C# demands a higher salary [than VB], then go for it (and there are a few out there, but they are seeing that the languages are pretty much the same, and it's .NET skills they are buying not the ability to put if-thens and semicolons in the right place).



  • C# or VB ?