GeekZilla
Should I use C# or VB .Net?
What a conundrum, each developer has their favourite. In this article I will try to document the pro's and con's, or at least the differences of each language.
I will admit that I am a C# developer but I will try to keep this unbiased.
VB | C# | |
Syntax | Verbose: If x Then..End If like VB6 | Terse: if ( x ) {} like C,C++,Java |
Arrays | Redim Preserve to resize an array | Use Array.Copy() to copy contents to a larger array |
Standards | Not a standard | Submitted for standardisation (http://msdn.microsoft.com/net/ecma/) |
Comments | Just ' or Rem available | Multi-line comments //, /* /, /// XML, /* XML multi-line */ |
Documentation | Not integrated with code | Generate documentation from XML comments |
Type conversion | CType(obj,type) | (type)obj |
With statement | Supports With...End With | no With statement |
Learning Curve | Easier to learn from VB6 | Encourages VB developer to think in terms of .Net rather than VB6 |
Performance | - | Rumoured that C# compiler produces slightly faster IL? |
Resources | - | C# is more common http://www.indeed.com/jobtrends?q=C%23%2C+VB.NET |
Code Quality | - | Traps errors such as unused or unassigned variables at compile time |
Readability | Long unreadable lines | Uses semicolon rather than carriage return to end statements |
... | #Region/#End Region around methods only | #region/#endregion around any statements |
Interoperability | - | Supports pointers via the unsafe/fixed keywords |
Multi-skilling | Java and VB have little in common | A Java developer can read C# code and vice versa |
See language syntax differences here
Author Dave Howard
I have been involved in IT development for the last 10 years - a lot of it around desktop applications and telecoms.