Sometimes differences between C# and VB could be subtle, for example consider these very simple two snippets of code, what they will print?    Sub Main()      Console.WriteLine(“Result is “ + Sum(Integer.MaxValue, 1))   End Sub    Public Function Sum(ByVal a As Integer, ByVal b As Integer)      Return a + b   End Function   static void Main(string[] args) {      Console.WriteLine(“Result is “ + Sum(Int32.MaxValue, 1));   }    public static Int32 Sum(Int32 a, Int32 b) {      return a + b;   } The first snipped written in VB throws a System.OverflowException, because the result of the operation cannot be stored into an integer value. The behavior of C# can be more surprising because [...]
Continue reading about Difference between C# and VB, simple add
In all type safe languages there is the concept of “casting”, an operation used to specify to the compiler that a variable of a certain Type has to be considered of different Type. Visual Basic has three operators to do a cast: DirectCast, CType and TryCast, each one behaving in a different way from the [...]
This post tells about Syntax and Semantic of VB and C# langages.
