A group blog from members of the VB team
It's common today to switch back and forth between VB.Net and C# for different projects, jobs, teams, etc. VB MVP Kathleen Dollard and C# MVP Bill Wagner have gathered some tips to keep in mind when you make these transitions. They both write for Visual Studio Magazine, which is where these articles were released last week as part of the December edition.
What C# Devs Should Know About VB by Kathleen Dollard
What VB Devs Should Know About C# by Bill Wagner
Editor in Chief, Patrick Meader, also wrote an Editor's Note for this issue On the Benefits of Learning Multiple Languages. He explains that "Developers of VB and C# can learn a lot from the similarities -- and differences -- between the two." It's an interesting read, so be sure to check out all three!
Nice. I learnt how to program using VBA, VB 5, 6 and .NET 1.0. Professionally I mostly use C#, and when I mention that I like to use VB.NET in my hobby projects ppl instantly looks down on me. Explaining that both languages ends up as MSIL doesn't help much. That's the reality in Denmark.
Well, I wasn't really going to talk about myself. Instead I want to thank the VB team for your cool blog, and then I wish that one of you VB ppl will team up with one of the C# ppl and write an article or two about the new features in C#4 and VB10. The important thing for me is to learn what new features both languages share and what new features that are unique for each of the languages.
Every time a new VS is released we get articles that explains some of the new features in the respective languages but it always take me some time to figure out what features are common and what's unique (and guess if I was extremely disappointed when I found out that VB9 didn't have auto properties :-P).
I'd like using both VB.Net and C# to write a class. VB doesn't dupport important .Net features like iterators, anonymous delegates etc.
I'll quote the articles here:
What C# Devs Should Know About VB by Kathleen Dollard:
"The most significant thing missing in VB is iterators. "
What VB Devs Should Know About C# by Bill Wagner:
"One of the more important points for a VB developer using C# to keep in mind is that iterator methods using yield return and yield break make it easy to create methods that generate, examine, or modify sequences. "
"You can see that at work in almost every LINQ query written (in either VB.NET or C#). Select, Skip, SkipWhile, Take, TakeWhile, and Where, among other methods defined in System.Linq.Enumerable, are implemented as iterator methods."
"Iterator methods are one of the core building blocks used to create the LINQ functionality you might have already used in your favorite .NET language."
If the Visual Basic Team was unable to implement (copy from C#) this feature for 3-5 years and says that it cannot be done in another 1+ year... you can understand people loosing faith in VB.
We understand that functional parity between VB and C# is a very important goal for us to achieve. In Visual Studio 2010, you will see a concerted effort by both languages to add features which previously only existed in the other. We will continue progressing in that direction in the future.
Please see a follow-up post that I've added here, on the new features in VB 10.0 and C# 4.0:
Is there some example using .NET 3.5 (VB) for C#'s
yield return "some string";
I am converting a C# app to VB.NET and am stuck on this part. Any help?
Here's an example which demonstrates how you can achieve this today:
We are also working on a feature for the next version of Visual Studio which will make this even easier:
Community Program Manager
The C# Yield functionality is part of a feature called iterators. Iterators are not currently supported in VB.NET but is being worked on as part of the Async Functionality for which there is a CTP that you can download and try but this should not be used in production code as this is still only a CTP.