What are the main differences between VB.Net and C #?

15

In addition to the syntax, what are the main differences between these two languages?

Is there any performance difference between them? Or is there a case in which it is extremely advisable to use one language and not the other, or is VB.Net just there to keep VB programmers familiar with the new language?

    
asked by anonymous 22.02.2015 / 18:31

3 answers

15

Your final conclusion is the best explanation for VB.Net to exist. I will not find anything easily, but there is some scattered information that shows this to be it. Unlike some languages that are better at some kind of problem, when comparing these two it is difficult to point out clearly why one is better than another if you do not have any previous background.

Current versions have fewer differences and are almost completely interchangeable.

Performance

In terms of performance there is nothing in the languages that profoundly change the result, mainly because most of the time will be spent executing functions that are the same in both (almost always written in C # and transformed into CIL code ). It makes more difference to the platform where it runs than the language itself. Nor will I talk about the question of which algorithms usually make the most difference.

Of course some language features may make a small difference, but you're probably comparing different things. So the comparison becomes unfair. To get equal results you need to write different codes. But note that the difference will be very small and you can not tell clearly which one is most advantageous.

In some cases the same code can produce better results in one than the other, but with little modification can equate both or even reverse the result. Comparing language performance is very complicated, in practice it does not. There is no faster language than the other in general terms, especially when they have very similar basic philosophies.

Styles

I do not think a list of small differences would help define something relevant to choosing one or the other. What is certain is that VB.Net has a little less ceremony than C #, but very little. There is more convenience in one or the other depending on how you look at the problem.

Generally, types, memory management, almost all basic algorithms and data structure constructs work the same, the difference is essentially syntactic.

Legacy of VB

VB.Net can use a style a bit closer to the original VB but it is not recommended to use it in new code. It may seem a bit easier to use this style but deep down it brings more problems in the long run. As there is this recommendation, in practice the advantage of familiarity is not relevant.

It's an illusion that you'll make an easier transition from VB to VB.Net. Legacy code does not converge so simply and the differences from VB to VB.Net are so great that the work of learning VB.Net may well be availed to learn C #. The different syntax between languages is the easy part of what you have to learn.

Difference in language support

There are a few more examples and material available for C # than VB.Net, but nothing significant that makes much difference.

C # has a feeling of being the official language and VB.Net is there because of the legacy. But this is not proven if the analysis is very objective.

Conclusion

Any criterion that can be observed seems to be too subjective. I doubt if anyone can give another reason to choose one or the other but to taste.

    
22.02.2015 / 19:01
6

In addition to the syntax, what are the main differences between these two languages?

There is an article in CodeProject that extensively illustrates the differences. It's not worth commenting all in this answer.

I mean, is there any performance difference between them?

No. The two are first compiled at CIL , so the performance is identical.

Or is there a case in which it is extremely advisable to use one language and not the other, or is VB.NET just there to keep VB programmers familiar with the new language?

I think @bigown's answer completely responds to this part, with some addenda: the adaptation of older programmers is quite costly and many prefer not to learn a new language.

There is yet another aggravation: The conversion of VB6 to VB.NET is not trivial, which does not bring any benefit in maintaining itself in VB.NET. Usually applications need to be rewritten and previous versions of systems are abandoned.

    
24.02.2015 / 22:19
2
  

Or is there a case in which it is highly advisable to use a   language and not the other?

C #

/ p>

Now a tip that came from VB6 and started learning now VB.net and C #, for those who have doubts, focus on C # and you will not regret it.

For those who want to start: Beginning in C # - English Course (with caption) Microsoft Virtual Academy

Microsoft Virtual Academy (if you are thinking of searching for VB.NET or Visual Basic do not click here);)

    
23.02.2015 / 00:36