Solved

VB.Net and C# pros / cons

Posted on 2002-06-20
17
1,172 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
ID: 7097197
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
ID: 7097252
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
ID: 7097551
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 1

Expert Comment

by:heapsteratwork
ID: 7097691
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
ID: 7097856
>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
ID: 7097860
>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
ID: 7097867
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
ID: 7099097
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
 
LVL 9

Expert Comment

by:GivenRandy
ID: 7099342
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
ID: 7099348
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
ID: 7099482
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
ID: 7100441
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
ID: 7100993
>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
ID: 7105098
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
ID: 10329814
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
ID: 10329990
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
ID: 10332280
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

815 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

10 Experts available now in Live!

Get 1:1 Help Now