Difference between C# and VB.NET

Difference between C# and VB.NET

 Dot Net Online Training from India

Difference between C# and VB.Net will be asked almost in every interview, if you have worked with both the language. There is syntax and keyword difference in both the languages. But the interviewer is not looking for such answers. The candidate needs to explain the functional difference between both the languages.

Here is some key differences in C# and VB.NET other than syntax difference.

  • In C#, using keyword is used to release unmanaged resources. This facility is not available in VB.NET
  • Optional parameter is supported in VB.NET. This is not available in C#.
  • Structure and unstructured error handling (On Error GoTo) is supported in VB.NET. (such type of unstructured error handling is not supported in C#).
  • Event gets bind automatically in VB.Net.
  • VB.NET is not case sensitive where C# is a case sensitive.
  • Shadowing is a VB.Net Concept by which you can provide a new implementation for the base class member without overriding the member. You can shadow a base class member in the derived class by using the keyword “Shadows”. The method signature, access level and return type of the shadowed member can be completely different than the base class member.
  • Hiding is a C# Concept by which you can provide a new implementation for the base class member without overriding the member. You can hide a base class member in the derived class by using the keyword “new”. The method signature, access level and return type of the hidden member has to be same as the base class member. Comparing the two:-
    • The access level, signature and the return type can only be changed when you are shadowing with VB.NET. Hiding and overriding demands these parameters as same.
    • The difference lies when you call the derived class object with a base class variable. In class of overriding although you assign a derived class object to base class variable it will call the derived class function. In case of shadowing or hiding the base class function will be called.
  • VB.NET is considered easier for beginners & such and has more built in functions that you might otherwise have to code by hand in C#.
  • With C# you can do lower level things like writing device drivers & such which wouldn’t be very feasible in VB.NET.

Some more differences between C# .Net and VB .Net

C# .Net

VB .Net

1)No unsigned int
1)supports unsigned int
2)Loosely typed language documentation 2)strongly typed language
3)no operator overloading
3)supports operator overloading
4)no pointers
4)supports pointers
5)no auto XML
5)supports auto XML documentation
6)no automatic memory management
6)supports automatic memory

management

 

For Dot Net Online training please log on to http://www.revanthtechnologies.com