Solved

VB.Net and C# pros / cons

Posted on 2002-06-20
17
1,170 Views
Last Modified: 2010-05-18
i'm starting to migrate my asp 3.0 and vb 6.0 code over to asp.net and vb.net, but i was wondering if it's worthwhile to go to c# instead of vb.net.

what are the advantages of c# over vb and vice versa? does either language have capabilities the other doesn't?

since both languages use the same clr, does it really matter, or is it more of a developer's preference?


if i get more than one answer, i don't mind adding additional questions to split up the points.
0
Comment
Question by:msdixon
  • 5
  • 3
  • 3
  • +5
17 Comments
 
LVL 4

Accepted Solution

by:
DarthPedro earned 50 total points
Comment Utility
Overall, it's more of a developer's preference.  If you already know VB, it will be easier to just learn the .NET class libraries than the libraries and a whole new language as well.

Since they do use the same runtime, they have the ability to create the same types of apps and use the same components.  But, there are a couple of language specific features that are different:

- VB support late-binding to objects directly, which requires more work to do in C#.
- VB automatically wires events to appropriate event names, but that has to be done explicitly in C#.
- C# allows you to write "unsafe" managed code in case you need to manipulate pointers in a manner similar to C++.
0
 
LVL 9

Author Comment

by:msdixon
Comment Utility
also, the ide for vb in vs.net is much nicer. it formats code, etc.... and let's face it i'm lazy.  :-)

we'll see what other people have to say about it.

thanks for the initial response.
0
 
LVL 4

Expert Comment

by:saar2
Comment Utility
I used to have a list of C# features that you cannot find in VB.Net.

I can only recall that:
A. C# allows you to use XML Documentation. This is a specific format for commenting you classes/methods/properties etc.. If you follow the instructions you can generate XML Document which can be translated to HTML using XSLT, or create a web site displaying the comments, or convert it to the MSDN format (CHM file) using a free tool.

B. C# allows operator overloading

C. VB allows default parameters values for methods.

D. C# allows unsafe code. You won't need this if you are converting code from VB6.

Some people say that in the next version of the .Net framework C# will be more "server side language" and VB.Net will be more "client/presentraion language".

My opinion that VB.NET differ from VB6 to much and you should go with C# to be closer to other languages like C++ and Java instead of learning this specific Microsoft propriety language.

Saar
0
 
LVL 1

Expert Comment

by:heapsteratwork
Comment Utility
my tuppence worth...


c# is case sensitive
VB.Net is not case sensitive, so cant have 2 names with difft case

c# requires semi colons
c# allows delphi style comments (//) & multi line comments (/* ...*/)

C# much cleaner code ;)

Delphi/C++ ers -> C#
VB Syntax freaks -> VB.NET

0
 
LVL 20

Expert Comment

by:Silvers5
Comment Utility
>C# allows operator overloading

You can overload your functions in VB.NET too..


It's a matter of trend.. All the languages at the end transfroms to the Intermediate language (IL) all these languages are fully object oriented.. you can do anything in any of them..
C# had an internal slogan "Java Killer" why? because it's syntax is more close to Java and Microsoft this way will attract all java developers to its platform.. new name is for marketing and politics (they are marketing it as a cool language..etc)

VB.NET is the "grown" baby of the .NET platform :o) and thus the recommended language since Microsoft knows that there are 3.5 million vb developers worldwide and they need the power of C++ and the flexibility of Java.. Not to mention the millions of ASP developers that will also focus on VB.NET

So as I said it is a matter of trend you choose the language you like.. you are not anymore limited to anything with the language..

regards.NET
0
 
LVL 20

Expert Comment

by:Silvers5
Comment Utility
>Some people say that in the next version of the .Net framework C# will be more "server side language" and VB.Net will be more "client/presentraion language


With the concept and current structure of the .NET platform, I'll have to disagree with the above mention.. A language has become like a flavor.. (You like blue, I like red.. You like C# , I like VB.NET)
0
 
LVL 1

Expert Comment

by:heapsteratwork
Comment Utility
Im compiling a list of fors and againsts so we can decide in house which language to go for.  I dislike vb syntax and much prefer the C# look, but thats just me.  The only advantage C# has over VB that will persuade the VB'ers inhouse (half delphi half vb) that we should all go to C# is the XML Documentation feature.

Also, C# and the doco standards have been handed over to an international body, so not proprietary to MS.

is the following true... ???  I think this is the same in C#??

>>VB automatically wires events to appropriate event >>names, but that has to be done explicitly in C#.
0
 
LVL 9

Author Comment

by:msdixon
Comment Utility
great comments so far.

the only difference which would cause an advantage for c# would be the xml documentation feature and the commenting of classed, methods, etc (/// <summary>....)

advantage for vb. the IDE is much nicer in vs.net.


comment:
>You can overload your functions in VB.NET too..

this is a GREAT feature. i use it all the time in my components.

i'll wait and see if any more comments come in then i'll start dishing out the points.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Expert Comment

by:GivenRandy
Comment Utility
First, I would recommend "Visual Basic.NET or C#...Which to Choose?" by Dan Appleman (the guru that brought us the Win32 API for VB, but uses both VB and C++):

http://www.amazon.com/exec/obidos/ASIN/B00005YX8N/qid=1024682655/sr=1-5/ref=sr_1_5/104-6125570-3694356

Second, my personal opinion is ... that since they both use the CLR and have the same features (actually, a couple more functions built-in for VB.NET), go with what you are most familiar with. Certainly, there will be some C++ snobs who claim C# is better. Obviously they don't know what they are talking about.
0
 
LVL 9

Expert Comment

by:GivenRandy
Comment Utility
First, I would recommend "Visual Basic.NET or C#...Which to Choose?" by Dan Appleman (the guru that brought us the Win32 API for VB, but uses both VB and C++):

http://www.amazon.com/exec/obidos/ASIN/B00005YX8N/randygivennancyg/104-6125570-3694356

Second, my personal opinion is ... that since they both use the CLR and have the same features (actually, a couple more functions built-in for VB.NET), go with what you are most familiar with. Certainly, there will be some C++ snobs who claim C# is better. Obviously they don't know what they are talking about.
0
 
LVL 9

Author Comment

by:msdixon
Comment Utility
givenrandy,

>Certainly, there will be some C++ snobs who claim C# is better. Obviously they don't know what they are talking about.

i like that attitude!
0
 
LVL 4

Expert Comment

by:RichW
Comment Utility
givenrandy, the C++ snobs can no longer laugh at us VB developers.  :)

According to Dan Appleman in Moving from VB6 to VB .Net, it's now really just a choice of preference.

Cheers
RichW
0
 
LVL 9

Expert Comment

by:GivenRandy
Comment Utility
>According to Dan Appleman in Moving from VB6 to VB .Net, >it's now really just a choice of preference.

True. I have that book as well. It is a good intro for VB6 gurus.
0
 
LVL 9

Author Comment

by:msdixon
Comment Utility
no one was able persuade me to move from VB.Net to C#, but it was a good discussion. since both languages use the CLR and are interpreted to an IL the capabilities are almost identical.

Thanks to all for the comments.


Darth got the points because he was first and no one else added any additional signifigant capabilities of either language.

thanks again,
matt
0
 

Expert Comment

by:MarkHartigan
Comment Utility
I just stumbled across the fact that VB.NET doesn't support operator overloading. Does anyone have any idea why they would omit that functionality, since it's obviously supported by the CLR. In fact, VB.NET respects it if it's calling a C# written assembly with overloaded operators.

It seems like it should have been easy enough for them to do. I wonder if there was some syntactical ambiquity which resulted when they tried to implement it. It just seems odd that it wasn't included.

Anyone from MS have any insight into this?

Mark
0
 
LVL 1

Expert Comment

by:heapsteratwork
Comment Utility
I was a delphi programmer for 6 years then went on to work in 2 .net shops - both about to move to .net - and both asked me to evaluate and compare vb with c#, c# won everytime in my recommendation but both times management overruled it and said as we have vb'ers we must stay with vb, because it will take too long to learn the new language.  The problem with that is coders still think its vb6 and code sloppy .net, rather than learning how to code properly. even to this day im trying to teach the vb crowd how to write safe vb.net code. They never write exception handlers or free resources (the .net garbage collection IS garbage as far as i can tell). This is a key point i think.  May be a longer learning curve but it pays off in the long run.  VB people say C# is too hard - its the same language different syntax!  Talk about lazy...!

There is a way round the vb.net xml documentation issue using Ndoc and XML commentator add-in, but it should never have been required. Apparently this is going to change with whidbey.  

I personally dislike the fact that i now program in vb.net, not C#, given i have c++/delphi/java roots.  Ive always looked down on vb6 code - and in the past refused to do work in it even when faced with being fired over it.  I wouldn't mind if microsoft would at least make the languages equal in all ways.  MS do some strange things i have to say.

Roll on whidbey..
0
 
LVL 9

Author Comment

by:msdixon
Comment Utility
i'm now using C# 100% of the time, and have been for about 1 1/2 years. i don't like vb (6 or .net) much. c# is a lot cleaner looking, and is more like other "real" languages than vb.

thanks again for the comments
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now