If I see one more blog entry complaining about VB's verbosity, or the elitism of C# developers, I think I'm gonna puke. Why can't we all just get along? Part of what makes the .NET Runtime unique is that it offers you a choice of syntax; we should embrace that philosophy, rather than wasting a lot of time sniping at perceived slights. If I wanted a single language to bind them all, I'd be writing in Java. 'nuff said.
One of the first e-books I read after .NET was released was Daniel Appleman's Visual Basic.NET or C# - Which to Choose. And it's still the best one on the topic. The answer, of course, is: it depends. The real choice you make is to use the framework; getting obsessive about the bits of duct tape we use to run the framework through its paces is completely and utterly missing the point. Which brings me to my favorite passage from the e-book:
So let me make one thing perfectly clear. Any of you who feel that the syntax:
if() { }is somehow morally superior to:
If .. Then End Ifare fools.
And yet, one of the things Dan predicted has come true: C# developers are paid more.
If the perception survives that C# is somehow better than VB.NET, there will be a set of managers and clients stupid enough to pay more for C# programmers than VB.NET programmers with identical experience.Written in early 2002, and still eerily accurate to this day.Now, as an ethical programmer, I know that you will question the wisdom of these managers and clients and point out to them the fact that there is no rational basis for paying more for C# developers than VB.NET. Why, you might even show them a copy of this very article to prove the point. But we both know that some will not be persuaded. Language choice is as much an emotional as a logical decision. It seems clear to me that in a case where a manager or client insists on paying more for C# development, you have a moral obligation to take their money, knowing in doing so you help promote the capitalist system that insures survival of the most efficient organizations. Just don't accept your pay in the form of stock or options, because the organization you're working for probably has other efficiency problems as well.
Anyway, since the need to convert between VB and C# comes up on a near-daily basis, here are some resources I've found helpful.
- Lutz Roeder's amazing Reflector, which can decompile .NET code to the language of your choice. If there's ever a nobel prize for .NET coding, Lutz is the obvious frontrunner.
- Quick reference guide to highlight some key syntactical differences between VB.NETand C#. Because sometimes I forget what { and } mean.
- Online C# and VB.Net translator. Great for quick conversion of snippets with minimal thinking. I've used a few and I like this one.