8

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
  • 225,720
  • 49
  • 378
  • 501
Niyaz
  • 51,917
  • 55
  • 146
  • 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
  • 139,101
  • 56
  • 254
  • 298
5

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
  • 92,195
  • 20
  • 143
  • 169
2

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

http://geekswithblogs.net/jmccarthy/archive/2007/01/23/104372.aspx

edit: Noldorin was faster :x

Bruno Costa
  • 2,618
  • 2
  • 16
  • 24
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
  • 53,505
  • 14
  • 110
  • 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,459
  • 5
  • 47
  • 73
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
  • 161,055
  • 37
  • 262
  • 269
Damith
  • 1,902
  • 3
  • 27
  • 40