Whats the difference between C# and VB?
Is one better than the other or something?
Printable View
Whats the difference between C# and VB?
Is one better than the other or something?
No real difference as they both use the same .NET framework. Its mainly syntax but a few variations like C# being able to handle pointers and VB being more of a RAD language separates teh two. The two are provided for programmers that are coming from C++ or Java to be more familiar with the syntax of C# and VB is more familiar with VB 6 and previous programmers.
C# vs VB is all a matter of style.
If you look closely at the features of both languages, you'll see that VB offers about as many features that C# doesn't have that C# offers that VB doesn't have.
C#:
- allows unsafe code (although you'll seldom see this used)
- allows assignments within expressions (e.g., if ((x = y.Value) == 2))
- anonymous methods
VB:
- allows optional parameters (but overloading methods is available in both C# and VB)
- allows you to define types within interfaces (although I've never wished I had this in C#)
- has a very flexible 'Select' construct (much more flexible than 'switch')
- has the 'When' filter for 'Catch' blocks (ok - I'm really stretching now...)
Question: is C# faster than Vb ? :bigyello:Quote:
Originally Posted by David Anton
So I've been told.
I dont believe so as I thought something along those lines of questioning was asked to the Ms guys the other week and it seemed it was negligible at best.
Because of VB's verbose nature, the MSIL code produced can be slightly longer in some cases. This can make equivalent C# code faster, but the difference is negligible. The speed boost that C# can provide is courtesy of unsafe code, which the majority of C# developers will never use. In computationally intensive sections of code, like heavy-duty string manipulation, unsafe code can provide a very significant speed boost.
VB and C# are just two languages. Is English better than French?
Oh course English is waaaay better then French :D
Unless you are doing an intense process or have a large program, the differences will never be noticed and difficult to measure the differences.
There's not really a difference per say.. Just think of it the way Microsoft was. There were three major types of programmers and Microsoft's number one goal was to become the top. What better way than to monopolize the development and programming industry? C# was made to snare the C and C++ programmers, VB .Net was made to grab the VB 6 and lower programmers, and J# was made to take the java programmers. Also, they were combining all of these languages to be held under one framework so they could go together so well. Honestly, it was quite a novel idea, in my opinion.
As for people that argue that there is a large difference between languages such as VB .NET and C#, that is because along the line, they have grown to be used for different things. VB being for RAD development and C# for "faster" execution time and stuff of the sort, but really, the only difference that someone such as yourself would need to know is that of the syntax differences. They all use the same framework and all in all can be used to do the same thing.
Okay, probablymillions of reasons why this hasnt happened. One probably being too much file size.
But why dont they combine the two?
Because for one, it will piss a lot of people off because they'd have to learn a new language, two, they would lose a lot of money in having to do new documentation and getting rid of the old ones, and stuff like that. Imagine all the stuff on the web that has to do with C# and VB .NET. Imagine if they'd have to do all of that for another language. It's just not a good idea. Besides, people like to choose between VB .NET and C#. Some people have a different upbringing. If they grew up with C and C++, they want to use C# and not VB or a mix of the two and if someone grew up with VB then they wouldn't want to use C# but rather VB .NET. Besides, at this point in time, the languages do have their differences. They are coming to be used with completely different things.
There are strong partisan camps for both VB and C#. It seems like J# is fading out, but the other two probably never will, especially since there are significant numbers who just refuse to switch.
Given the stink kicked up when Microsoft "abandoned" all its VB6 developers and "forced" them to use VB.NET, I can't imagine the backlash if they now discontinued VB.NET.
Why would they combine the two though? What benefit is there to us or them if they do? They are two different languages. We have the choice of using one or the other or both. Why would anyone complain about that? VB.NET and C# are two different languages. They support a common class library, which is a plus, but they are two different languages, which is a plus.