VBNET
C Sharp
The Difference Between

What are the differences between VB.NET and C Sharp?

Answer

User Avatar
Wiki User
12/20/2010

VB.Net identifiers are not case sensitive, C# identifiers are.

VB.Net variable declarations have the data type after the variable, C# variable declarations have the data type precede the variable.

VB.Net data types are written slightly differently; e.g. Boolean, which in C# would be written as Bool.

VB.Net statements are terminated by an end of line, whereas in C# they are terminated by a semicolon.

VB.Net statement blocks (e.g If... Then) automatically assume multiple line statements, whereas in C# the same statement block assumes a single line statement unless { } is used.

VB.Net uses parenthesis () to delimit array elements, function arguments and property indexes, whereas C# uses parenthesis to delimit function arguments only, and braces [] to delimit array elements and property indexes.

VB.Net has a specific integer division operator ( \ ), C# does not.

VB.Net has an exponentiation operator ( ^ ), C# does not.

C# has a variety of assignment operators such as Left Shift (<<=) and XOR (^=), VB.Net does not.

VB.Net has different syntax for operators in some cases, such as not equal, which in VB.Net is written as <> and in C# as !=.

VB.Net supports unstructured error handling (Note: For backward compatibility only, it is not good practise), such as OnError GoTo, whereas C# does not.

VB.Net supports optional parameters, C# does not.

VB.Net supports implicit late binding through reflection, although you can do this in C# it is much easier in VB.

In C# you can write unmanaged code (There must be a reason for this functionality somewhere), in VB you cannot.

VB.net uses different keywords than C#, such as 'NotInheritable' in VB.Net becomes 'sealed' in C#.

Vb.Net does not support operator overloading while C# supports it.