VB.NET and C# Comparison This is a quick reference guide to highlight some key syntactical differences between VB.NETand C#. Hope you find this useful! Thank you to Tom Shelton, Fergus Cooney, and others for your input.
// Single line /* Multiple line */ /// XML comments on single line /** XML comments on multiple lines */
Data Types
Value Types Boolean Byte Char (example: "A"c) Short, Integer, Long Single, Double Decimal Date
Reference Types Object String
Dim x As Integer Console.WriteLine(x.GetType()) ' Prints System.Int32 Console.WriteLine(TypeName(x)) ' Prints Integer
' Type conversion Dim numDecimal As Single = 3.5 Dim numInt As Integer numInt = CType(numDecimal, Integer) ' set to 4 (Banker's rounding) numInt = CInt(numDecimal) ' same result as CType numInt = Int(numDecimal) ' set to 3 (Int function truncates the decimal)
VB.NET and C# ComparisonThis is a quick reference guide to highlight some key syntactical differences between VB.NETand C#. Hope you find this useful!Thank you to Tom Shelton, Fergus Cooney, and other