We help IT Professionals succeed at work.

VB.NET or C#.NET for VB-C# Programmer

Phil Chapman
Phil Chapman asked
on
Medium Priority
348 Views
Last Modified: 2010-04-16
I have been writing GW Basic, Quick Basic, vb2 to vb6 Code for about 20 years.  On a scale from 1 to 10, I would put my VB6 technical abilities to be at about 8.  

I have not worked with .NET

I have an excellent repetition for getting good code out fast.

The company I work for is moving from being a VB shop to a C# shop.

I have been offered a full AppDev C# Developers Training Suite.

My Question Is
1.  What are the Advantages of C#.NET over VB.NET
2.  I understand they are a considerable difference in VB6 and VB.NET.  Since I have never worked in .NET before will the change from VB to C# be very dramatic.
Comment
Watch Question

Commented:
You are opening up the "my language is better " pandora's box, good luck. There are many opinions on VB vs. C#. The most interesting article I have read on this is at:

and there are many many more (http://blogs.msdn.com/csharpfaq/archive/2004/03/11/87816.aspx for example).

IMHO: There is no real advantage to choosing one over the other. Having been a steadfast vbscript, vb6 coder for a long time, I have picked up C# with no problems. In the modern world of software design it is not the language that matters so much as your design abilities. Good software design works in any good language, and anything from Smalltalk to C, Java to C# to VB.NET (in no order of precedence or personal opinion) can be the best tool for a particular job if it matches your requirements.

So much of the choice about language should be what your team is best able to work with. It is no good insisting on VB as a .NET language if they were all java programmers, in that case C# would be a much better choice.

As far as VB6 vs. VB.NET 2.0 goes, it is completely different, far more powerful, and a long way removed from Visual Basic as it used to be. As far as c# vs. VB.NET goes, if you are being offered C#, take it. You are an advanced programmer and another modern language will help you a lot. Also, many of the things you learn in c# can be easily translated to VB.NET.

The change is not dramatic if you accept the fundamentals (case-sensitivity, braces, semicolons), just focus on the end-goal, getting your good code out fast.

Andy

PS OReilly do a nice little VB.NET to C# conversion pocket reference - maybe you should take one along to the course and learn two new languages at once.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Commented:
Apologies, I didn't include the "best article I have read" link, it is:
http://www.codeproject.com/dotnet/CSharpVersusVB.asp, and there is a follow up here http://www.codeproject.com/useritems/vbdefamation.asp. I think that demonstrates how touchy people can get over this one. As a programmer of both VB.NET and C#, I simply found the first one interesting, and not insulting, and like the rest of the un-peer reviewed web, to be taken with a liberal sprinkling of salt.

If you google for C# vs. VB.NET there are so many articles flying around its scary.
Carl TawnSenior Systems and Integration Developer
CERTIFIED EXPERT
Commented:
Oooh goody another which is best discussion :o)

The biggest challenge you'll find is the move from VB6's quasi-OO to full blown OO in .Net.

I've personally used C/C++ and VB for a good few years, but have tended to stick mostly to C#, purely because I find the syntax to be less cluttered than in VB.Net. At the end of the day both languages will compile to the same MSIL, so its purely a matter of personal preference.

Commented:
I'm sure I read an article (maybe on a blog) about the same piece of code in VB.NET and C# compiling to different MSIL - giving VB.NET the edge in performance for that obscure case. Can anyone post the link to it?

Its nice to hear someone else say there is no difference, carl_tawn, especially from a c/c++ background. At least there are some sensible people in the world.
Carl TawnSenior Systems and Integration Developer
CERTIFIED EXPERT

Commented:
There were a couple of coding constructs in 1.1 that existed in C# but didn't have an equivalent in VB.Net, the "using" statement for one, but I think they are more or less the same in 2.0

Maybe "At the end of the day both languages will compile to the same MSIL" should be revised to "At the end of the day both languages will MOSTLY compile to the same MSIL".

Commented:
The using statement's equivalent in 1.1 was the Imports statement, wasn't it?

Or revised even further... "MOSTLY compile to the same MSIL except when your grandmother stepped on a spider on the first monday of the month".
Carl TawnSenior Systems and Integration Developer
CERTIFIED EXPERT

Commented:
Maybe "using statement" wasn't quite the correct term. Essentially it allows you to do someting like:

    using( SqlConnection conn = new SqlConnection("ConnectionString"))
    {
         // Yada yada
    }

This construct essentially meant that Dispose() was called on "conn" as soon as it dropped out of the block.

Commented:
yes, I misunderstood. More differences include optional parameters in VB.NET (and VB6) method declarations, whereas in c# you use overloading of methods and chaining of constructors to achieve the same.

Results for comparing the languages syntactically:
http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxgrfLanguageEquivalents.asp

Author

Commented:
Thanks fellows, you hve been verry helpful.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.