Comparison Between C# and VB.Net

1223cc8e7310799121bb
Chudovo OU
  • Date Published
  • Categories Blog
  • Reading Time 2-Minute Read

C# vs Vb.Net language comparison

No doubt, both .NET languages hold phenomenal advantages and are great tools to accomplish software tasks. But the difference between their syntax and keywords makes one a better performer in the race of C# vs Vb.Net.

Syntax Differences

VB (Visual Basic.NET) is quite a simple language to understand for it resembles the basic English language. Unlike other languages, including C#, it mostly uses words like AND. C#, on the flip side, is a part of the C family and owns the features of Python, Java, and C++.

Moreover, in contrast to Vb.Net vs C#, C# is case-sensitive, while VB is not. Below are the two examples of the features that prove the fact.

Shadowing

In VB (Visual Basic.NET), the Shadow feature helps a developer provide a new implementation of a base class member without overriding a member. By using the keyword ‘Shadows’, one can allow a base class member into a derived class. The point to be noted is that the return type of the shadowed member is not the same as the base class member.

Shadow feature is not supported in C#.

Hiding

Hiding is a C# concept and is also known as method shadowing. It is the feature by which a developer can allow a new implementation of a base class member without overshadowing a member. By using the keyword ‘new’, the implementation of the methods of a base class from the derived class can be hidden.

The hiding feature is not supported in the Vb.NET programming language.

Keyword Differences

Writing syntax is different for both languages. Here are some examples of the differences between C# and Vb.Net keywords.

  • To declare a variable, ‘declarators’ is used in C#, whereas, ‘Private, Public, Friend, Protected, Static 1, Shared, Dim’ is used in VB.
  • To create a new object, ‘New’ is used in C#, whereas ‘New, CreateObject ()’ is used in VB.
  • To refer to the current object, ‘this’ is used in C#, whereas, ‘Me’ is used in VB.
  • To retrieve characters from a string, ‘[]’ is used in C3, whereas, ‘GetChar Function’ is used in VB.
  • To declare a class, ‘Class’ is used in C#, whereas, ‘Class is used in VB.