Discussion Locked

VB .NET vs. C# .NET

0 helpful
22 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
What are the advantages (or disadvantages) to using VB .NET over C# and vice versa? Is each language more suitable to particular types of applications?

22 replies

by binghong

There are not significant advantages or disadvantages between C# and VB.NET. I use C# at work because my previous programming experience is from C/C++ and Java, so I like that bracket syntax instead of plain English in VB. If you start a new project without modifying old code, I suggest that you use C#. It is more object orient than VB.NET.

by majolar

There's a simple difference between VB.Net & C# - more money! This difference is caused by a number of factors like:
- Perception that VB developers can't do OO programming
- Microsoft is definately investing a lot in C# (Look at the sample code for the latest technologies - most of it is in C#)
- Don't take my word for it, take a look at your local job listings.
- Mono is done in C#
- Many third party tools only support C# (or support C# initially)

If you're just strating up, save yourself some pain and learn C#.NET and get more money for the same level of experience as VB.NET developers.

BTW: Microsoft won't tell you/advertise that C# is fractinally faster than VB.NET and guess what I'm a VB.NET developer who's just converted to C#!

by bucky kaufman (mcsd)

re:
how is c#.net faster than vb.net if they both get compiled down to the same il??
----- ----- ----- ----- ----- ----- -----

They don't get compiled to "the same" IL.

Consider an example - creating an array of Objects, through which you want to iterate each's properties.

The "logic" that is used to create, manage availability, and destroy the objects - as well as the way of accessing the properties - is different in C, from VB. Therefore, the underlying IL is different.

VB assumes that you are going to need some safety and usability functionality that C might not mandate - that means the C code will likely be faster because there's less code to execute.

by ksamarakoon

VB still remains the inferior language although it has been seriously improved on with the invention of '.NET'. C# however, is more useful for more powerful features and speed. If you already know a language like Java, then you'll have absolutely no problem learning C#!

by Member 20965667

I started out on VB.NET moving from VB6. I've since learnt C# too and had a big part of researching which route my employers should follow. We did alot of digging and found the following...

1. There is a massive amount of disinformation and assumptions out there. Alot of people assume because C++ was faster than VB6 then the same applies in .NET. Utter rubbish. If you use strict typing with VB.NET (set 'Option Strict On') then the code is as quick.

2. I have documents that list every little thing that one language has that the other doesn't. VB.NET does the odd thing C# doesn't and vice-versa. The things that only one or the other does are limited and can be counted on one hand. For 99.9% of folk both languages will do the job perfectly well.

3. Alot of .NET is about the Framework. The framework is common to all the .NET languages.

There is no right and wrong answer to this dilemma. My advice is learn the one you are most comfortable with now. If you're a C++/Java head then learn C#. If you're from a VB background then learn VB.

Once you're over the initial learning curve i'd then suggest you learn the one you didn't learn already. I've recently done a course in C# and it was pretty painless picking up the syntax and construct differences. Some things I found more natural in C#, some other things I found a pain (like having to wire up events yourself). I was productive straightaway though as alot of things you just code the same as in VB because the .NET Framework is common to both languages.

I hope this helps.

by maverick17

I think Martin's hit it on the head: if you bother to learn how to write efficient code, you should be able to use either language and achieve the same or similar performance.

From my experience, in what I've seen produced by VB.NET coders (BTW - I pretty-much exclusively use VB.NET), there's justification for C# coders to call their VB counterparts names: the quality of the code is crap and I think there's one main reason for this:

Many VB developers just don't get OO. I believe the reason most companies are looking for C# people are that they want to attract people who can architect an n-tier application. Many VB developers think an object-oriented design involves using ASP.NET server controls because they're objects, right?

Often, developers choose C# because they had a background in Java or C++ and it's more natural to move to C#. Then they see an English-like language such as VB, have a look at what some of these people are turning out, then scoff and mock VB developers in general as Development Gumbies.

I'll always prefer VB.NET in my development, but from what I've seen of VB.NET code in Australia, there's some very good reasons why VB-ers have copped a bagging. VB Guys, if you're moving to .NET please learn how to write real OO code and stop coding like you did as an ASP scripter...?

I think part of the blame must go to Microsoft, too, for softening on the migration to .NET. My understanding was that things like implicit type conversions were going to be a thing of the past. Seems they caved to VB6 pressure and allowed this little "Option Strict Off" beast into our blissful New World.

So with Martin's 2 cents, I've just made up a dollar.

by siby12

I totally agree. I have found the best way around this is to learn both languages. Start with the one you are comfortable with and then switch to the other. You will be more markertable

I would also encourage developers to be conversant with both .NET and J2EE platforms .. what have got to lose.. market yourself!!

by elmonk

I can only confirm the statements by Binghong and others and warmly recommend the transition to C#. We are a small development shop with only a handful of programmers, mostly with at least some VB and Jscript experience. The transition is not that much one about learning another language but more understanding the new paradigms and finding your way through all available objects.

Elmonk

by pauliehaha

I recently attended the MSDN Roadshow in London and one of the speakers suggested that VB.NET is more suitable than C# for coding around the new Office suite.

My understanding is that the .NET framework is built with C#, so I guess there is an argument for usage depending on what you are building.

I'm a VB guy and am starting to make the transition to .NET so I've thought long and hard about whether it's now time to move to a C-based language by learning C#.

C-based languages are common to many computing systems so it might be easier to make a transition if the need ever arises!

I agree with martin.jordan's comments above, though, after a while I thought well hey, it would be a quicker learning curve to start with VB.NET first, as I'm used to the syntax.

As I learn more about .NET it's clear a lot of it is to do with the framework so once I'm comfortable using .NET the transition to C# shouldn't be too difficult - I intend to be at least comfortable with C#, these days you have to be multi-skilled so learning both certainly won't hurt your prospects!

by jloranger

I get the feeling that the best route is to start with what you are comfortable with and move on from there. However, knowing both at some point is probably best.

by georgeaaa1

After a month struggling with virtually no success in .net/c# I came across this 15 part series on the datagrid:
http://aspnet.4guysfromrolla.com/articles/040502-1.aspx

and after working myself through most of this I finally learned enough about the paradym of .net, the framework, and objects to successfully complete an intranet project using Visual Studio that was due a month later. Previously I could accomplish almost anything using javascript, asp/vbscript, and sql. I'm entirely self-taught in web programming but taught contract developers how to do what our specs required in the interroperability of server/client web applications. ASP.NET about did me in until I found these 4GuysFromRolla!

by borlander

Delphi.Net and C#Builder are much cleaner than any of the Microsoft products and, in the case of Delphi, far more compatible with existing Win32 source code.

VB6 programmers will probably find that learning Delphi is easier than either VB.Net or C#.

As usual, the Borland compiler folks have produced a much better product than Microsoft. If they only had a decent marketing group...

by dale.wilbanks

Are you an Elmo, or a Rambo?

Let's face it: The C syntax for programming is now a standard across C, C++, C#, JavaScript and Java. There is good reason too. The C syntax is less verbose. There are 75 keywords in all of C#. Can you even count how many are in VB.Net? I'm guessing 400+.

I guarantee you I can teach a VB6 programmer C# faster than I can teach them VB.Net. There is simply less to learn, and nothing to 'unlearn', as there would be with a VB/VB.Net transition.

VB.Net is a legacy language, it's only true use is for maintaining legacy code. VB, it was good to know you in the day; I'd rather do VB6 than C++ for a Windows app back when.
But C# is the mack daddy now. Loving it!

by Member 27824808

To add, it is easily overlooked that you have to learn new key words to use VB.NET in an object oriented way. It makes more sense to learn the more widely-accepted syntax that spans Java, C++, C, etc. instead of a new set that is only used in one place for the purpose of making VB object oriented.

Further, the learning curve of going from VB to VB.NET includes at least the introduction of syntax for the object oriented capabilities of VB.NET and the vast .NET framework. To address the first point, the new syntax of VB's object oriented capabilities is as new as the syntax of C#'s object oriented capabilities to the VB developer. To address the second point, the framework will be the other mountain to climb in either language. Knowing the magnitude of the effort just described, the need to write "int x;" instead of "Dim X As Integer" is a very small component for of going from VB6 to C#.

Once C# is learned, the new syntax will make the programmer more efficient. It takes less key strokes to write "{", "}" and ":" instead of "Begin", "End" and "Extends". The readability aspect is insignificant in my experience. Whether it is VB or C# code, it depends on the developer's skills, not the whether "Begin" or "{" is used, that dictate how readable code is.

My 2.5 cents,

Adam

by comparin

ASP.NET is written in Managed Code. What language are the Microsoft developers using?

Longhorn is being written in Managed Code. What language are the Microsoft developers using?

Yes, C#. What does this tell you?

by valko

do not change media with a goal?

ANY language is just a tool, and I've seen disaster projects in C# and very good in VB.NET and vice versa (I do both now) - the point is that I personally like much more VB because it is much more easy human readable even if you are not a programmer, and second abstraction is much better (handling events etc.) - why to loose time to invent the wheel again?

I start my career 20 years ago with assembler, do C and Basic - it was not even Visual yet ;-) and I bet I can do much effective program on Basic that one on C (I win some bets already) and the same is valid for VB.NET and C# if you will NOT do any very special scientific calculations involving unmanaged pointers they are ABSOLUTELY the same in the point of effective complete application programming lifecycle.

by jim

Mainly that the Microsoft programmers came from C/C++ backgrounds and would naturally prefer to stick with the syntax that they know.

It also means that the C# language is unlikely to be as RAD or user-friendly to non-professional programmers as VB.Net. It is written by professional prgrammers for professional programmers.

The down side ia that it also means that the vast majority of source code and power features will be developed by Microsoft developers for themselves first (if for VB.Net at all) and that the really neat features of VB.Net (like Edit & Continue) will find their way into C#.

Even now, some data types in C# have no equivilent in VB.Net. You can port any VB.Net data type to C#, but not from C# to VB.Net. Seeing as how the majority of source code will be in C#, this can be problematic for VB.Net programmers.

by cimnik2999

I have to agree with you on this one. I started out with VB. When I attempted to teach myself C++, I had a hell of a time with classes. Then I moved on to Delphi, where I really learned how to do OO. The transition from there to C++ was rather painless (writting simple console apps, not MFC or Win32).

Now that I have moved on the the .NET platform, I have never bothered to touch VB. I find the new keywords and code way too confusing and overcomplicated, such using whole words where C# uses one character. Not to mention the variable names that all theses keywords waste, and then futher making variabled case-insensifice.

I personally code only in C# and the new C++/CLI languages, depending on if i need to use unmanaged code or not.

by a_dangerous_mind

I'm an MCSD who's developed in C# and VB.NET, as well as Visual C++ .NET. Here's my take:

Both languages use the same ol' .NET framework. It's even possible to use a number of VB.NET functions in C# provided you provide the reference to the correct namespace (Microsoft.VisualBasic -- and I believe you need to add the reference to the correct .DLL). The vast majority of the functionality you need comes from the framework.

It's possible to write very good code in both languages and very bad code in both languages. Sound development practices usually count more than the choice of language where both use the .NET framework.

Both are inferior to Visual C++ .NET if you need to use Windows API functions to any extent to achieve the desired functionality in your application.

Corporate development standards may determine which language you use more than your own personal preference. Your personal preference will more determine which one you learn first and which one you use for personal utilities and proejcts. It's better in the long run to learn both C# and VB.NET to increase your own marketability.

This discussion is closed to new replies.