Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between C#.net and Visual Basic.net?

I have a small experience in VB.net and I would like to learn C#.net

What are the differences between VB.net and C#.net?

Is there any difference in performance between these two?

Apart from the syntactical differences, are there any major changes that I have to keep in mind?

like image 976
Niyaz Avatar asked Feb 07 '09 13:02

Niyaz


People also ask

What are the differences in C?

In a nutshell, the main difference between C and C++ is that C is a procedural with no support for objects and classes, whereas C++ is a combination of procedural and object-oriented programming languages.

What is difference between C plus and plus C?

There is a major difference between C and C++. The C language is a procedural one that provides no support for objects and classes. On the other hand, the C++ language is a combination of object-oriented and procedural programming languages.

Is C better than C+?

The main difference between C and C++ is that C++ is a younger, more abstract language. C and C++ are both general-purpose languages with a solid community. C is a lightweight procedural language without a lot of abstraction. C++ is an object-oriented language that provides more abstraction and higher-level features.


2 Answers

The Language Features section of the Wikipedia article offers a good overview. Performance is essentially equivalent in almost every aspect, from what I understand.

like image 146
Noldorin Avatar answered Nov 16 '22 00:11

Noldorin


Performance is equivalent if you write equivalent code, but VB.NET has constructs that are in there for "backward compatibility" which should NEVER be used. C# doesn't have some of these things. I'm thinking specifically of:

  • Functions which are in the Microsoft.VisualBasic namespace which are members of other standard .NET classes like Trim(). The .NET classes are often faster.

  • Redim and Redim Preserve. Never to be used in .NET, but there they are in VB.

  • On Error ... instead of exceptions. Yuck!

  • Late binding (sometimes derisively called "Option Slow"). Not a good idea in a non-dynamic .NET language from a performance perspective.

VB is also missing things like automatic properties which makes it pretty undesirable for me. Not a performance issue, but worth keeping in mind.

like image 41
Dave Markle Avatar answered Nov 16 '22 02:11

Dave Markle