My dirty little secret


I have a secret confession... l'm loving VB.NET.

I have been using C# solidly ever since the very first beta of the .NET Framework back in 2002; my background is all VB right from VB3 to VB6 (version 6d to be precise) and every version in between until I met .NET. I did a little C++ here and there, even tried Java a couple of times, but when I saw C# I loved it (and still do) and it has paid my mortgage and fed my family ever since. Back in 2002 I did attempt to be multilingual and learn .NET in both VB and C#, but as the learning curve increased the more my skills in VB decreased. Until today...

I'm involved in writing some training material where I have to produced any code samples in both C# and VB. I was not looking forward to the prospect of writing VB code again; seeing it more as an overhead to the project than anything else, a chore even. However, I initially wrote some code to create a FixedDocument using C# and thought I'd have a quick stab at writing it in VB, just to see what it would feel like after all this time...

It felt natural, it felt like I had come home. The syntax just flowed out of my fingers, and I did not make any of the C# school boy errors of putting semicolons where they shouldn't be or using forward slashes for comments. I did have some funky C# syntax to deal with, that I had no idea how to convert - but then there was Lutz and Reflector on hand to help with the conversion (who knew how useful de-compilers would be before Lutz made it so easy?)

Here's the C# code that I wrote first (the third line was the one giving me the translation issue):

FixedDocument doc = new FixedDocument();
PageContent p1 = new PageContent();
((IAddChild)p1).AddChild(CreatePage("Hello, World!"));

Now for the VB version:

Dim doc As FixedDocument = New FixedDocument
Dim p1 As PageContent = New PageContent
DirectCast(p1, IAddChild).AddChild(CreatePage("Hello, World!"))

(/me slaps head, "Oh(!), DirectCast, I should have thought of that(!)") I would never have figured that out on my own, really, never!

In summary, I'm a C# head and probably will be for many years to come, but I have a lot of love for VB.NET (that does not make me a bad person); there may even be some abandonment issues that I need to address to make my peace with VB, but I think, finally, I can and today was that first all important step.

.NET Framework 3.5 Namespace poster


Paul Andrew, a Microsoft Product Manager for WF and WCF, has posted an update to the .NET Framework Namespace chart. Click here for Paul's post or click the image above to download the PDF.

Access to a colour A3 printer essential - incidentally, if you do have access to an A3 colour printer, could you print me one off while you're there? Working from home does have some disadvantages (it would make a nice Christmas present :-).

WPF - Bootcamp


The MIX University - WPF Bootcamp is awesome stuff; I have been slowly working my way through all the content this week. I highly recommended taking a look, if you run "Lunch 'n' Learn" or "Brown Bag" meetings of a lunchtime then this is ideal material for you (it is also worth looking at the content over at DNRTV too).

Here are the ones I think are worth watching:

  • Building WPF Applications Part I & II (Ian Griffiths); Ian wrote the book on WPF with Chris Sells.
  • Controls, Styles and Templates (Kevin Moore); I spoke about Kevin in my last post, this is guy is amazing and so is his bag-o-tricks.
  • Data Binding in WPF (Bea Costa); Bea is a tester on the WPF team and describes beautifully the ramifications of data binging and how to use it. It would be better to watch this one before Kevin's, even though they appear in the order I have presented on the schedule.
  • Real World Experiences - Vertigo Family Tree Explorer (Scott Stanfield); I have spoken about Scott, Vertigo and Family.Tree before - this was clearly done before the MIX 07 presentation as they still have not named it (they could not call it Family Explorer).

Each one is about an hour, some a little more some a little less. Also note that there is a problem with the sound, it's out of sync with the video. This did not cause me too much grief as most of the time you're looking at slides or code. It was just a little annoying at times.

There are many more lectures there than I have listed here, but I have watched nearly all of them; while some of others are interesting they are not as good as the ones I have outlined.

I hope you have a nice lunch (or two).