Comparing C# and VB.NET
A reader wrote me just now:
Hi,
I just came across your blog and seeing that you're mentioning random thoughs on .NET, I was hoping you'd be able to answer this question: Is there any real difference to coding in VB or in C# when it comes to the .NET framework? If there are differences, do they still exist when I narrow the topic down to .NET web applications?
Thanks,
Max
When it comes down to it, in my opinion, there aren't many significant language differences between VB.NET and C#. Most of the constructs in those languages are achievable from the other language, which is why you'll often see samples online in both languages. I think VB.NET includes more implicit conversion operators, as well as a bunch of other constructs if you disable option-strict compiling (such as late-binding). C#, as a language, will generally be more explicit than VB.
With VS 2005 (C# 2.0), C# includes anonymous methods, which are not a VB construct - VB users can workaround it by declaring new types/methods as necessary (which is what the C# compiler does under the hood). C# 2.0 also supports new iterator methods (using the yield keyword), which I think is unsupported by VB.
VB includes a ton of "built-in" functions, which usually delegate to other .NET framework library functions that are accessible by C#. Because of that, VB programs load several .NET framework DLL's that are not always needed in all programs, but are required for supporting VB built-in functions. In C#, a lot of what the language does to supplement the .NET Framework isn't providing specific built-in functions per se, but more language features, that affect the way your code is compiled (instead of introducing other dependencies).
In regards to ASP.NET and web applications, I don't think that the above discussion applies any differently - the ASP.NET integration should be nearly identical for both languages. Any preference towards choosing VB over C# or vice versa will probably be off of developer's taste.
I'm sure other folks out there will point out other important differences between C# and VB, but these are the ones that come to mind.