Comparison for C# and VB.Net


C#VB.Net
Case sensitiveYesNo
Self reference to current objectthisme
No explicit instance of object neededstaticShared
Refer to base classbaseMyBase
Declare class that can't be inheritedsealedNotInheritable
Declare method that can't be overriddensealedNotOverridable
Declare method that can be override in derived classvirtualOverridable
Declare method that must be override in derived classabstractMustOverride
Declare a class must be inherited. An instance of the class cannot be createdabstractMustInherit
Comments/* comment */
//comment
 'comment
Empty objectnullNothing
Method that does not return valuevoidSub
Declare a variableint a = 0;Dim a as Integer = 0
Declare an arrayint[] a =new int[3];Dim a() As Integer
Declare an enumerationenumEnum
...
End Enum
Iteration loop structurefor
foreach
For ... Next
For Each ... Next
Conditional loop structurewhileWhile ... End While
Conditional statementif ... else ...If...Else...End If


Operator and data types
C#VB.Net
Equal===
Not equal!=<>
Division/\
Modulus%Mod
Logical AND&&And
Logical OR||Or
Logical NOT!Not
Integer datatypeintInteger
String datatypestringString
Boolean datatypeboolboolean
Byte datatypebyteByte
Decimal datatypedecimalDecimal
Float datatypefloatSingle
Double datatypedoubleDouble
Date datatypeDateTimeDate

0 comments:

Post a Comment

top