9

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?

svick
  • 236,525
  • 50
  • 385
  • 514
Niyaz
  • 53,943
  • 55
  • 151
  • 182
  • Possible duplicate of [What are the most important functional differences between C# and VB.NET?](https://stackoverflow.com/questions/11632/what-are-the-most-important-functional-differences-between-c-sharp-and-vb-net) – Popo Mar 29 '19 at 16:00

6 Answers6

8

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

Noldorin
  • 144,213
  • 56
  • 264
  • 302
6

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.

Dave Markle
  • 95,573
  • 20
  • 147
  • 170
3

I think you will find the answers to your question in this articles:

http://en.wikipedia.org/wiki/Comparison_of_C_sharp_and_Visual_Basic_.NET

and

Link

edit: Noldorin was faster :x

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Bruno Costa
  • 2,708
  • 2
  • 17
  • 25
2

The first thing to know about learning C# is that it is not pronounced "C#.net", it is just C#. Microsoft tacked on ".NET" to VB, because there was a previous version of VB that didn't work on the .NET Framework. C# was created specifically with the .NET Framework in mind, so the ".net" is implied and unnecessary. Also as a side note putting "C#.NET" on your resume really tips off a knowledgeable manager to your skill level, or lack there of, regarding C#.

Also this Wikipedia article is really good for showing the pros and cons as well as the differences between C# and VB.NET at a high level.

Nick Berardi
  • 54,393
  • 15
  • 113
  • 135
2

Follow following links which give detailed differences

http://www.harding.edu/fmccown/vbnet_csharp_comparison.html

http://www.codeproject.com/KB/dotnet/vbnet_c__difference.aspx

http://support.microsoft.com/kb/308470

In spite of differences as mentioned at http://support.microsoft.com/kb/308470 both C# and VB.Net are first class citizens of .Net world

Although there are differences between Visual Basic .NET and Visual C# .NET, both are first-class programming languages that are based on the Microsoft .NET Framework, and they are equally powerful. Visual Basic .NET is a true object-oriented programming language that includes new and improved features such as inheritance, polymorphism, interfaces, and overloading. Both Visual Basic .NET and Visual C# .NET use the common language runtime. There are almost no performance issues between Visual Basic .NET and Visual C# .NET. Visual C# .NET may have a few more "power" features such as handling unmanaged code, and Visual Basic .NET may be skewed a little toward ease of use by providing features such as late binding. However, the differences between Visual Basic .NET and Visual C# .NET are very small compared to what they were in earlier versions.

Sachin Chavan
  • 5,578
  • 5
  • 49
  • 75
0

No matter which language you select based on your personal preference and past experience, both languages are powerful developer tools and first-class programming languages that share the common language runtime in the .NET Framework.

Says by Microsoft https://web.archive.org/web/20061027230435/http://support.microsoft.com/kb/308470

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
Damith
  • 1,982
  • 3
  • 28
  • 42