Using the .ToDictionary() Extension Method

Last time, I showed how you can use the Cast() extension method defined on IEnumerable/IEnumerable(Of T) to do an element conversion for a sequence that implements one of the enumerable interfaces. Today I want to talk about the ToDictionary extension method. This extension method lets you take a sequence that implements IEnumerable(Of T) and build…


Using the .Cast() Extension Method

If you take a look at the set of extension methods offered on IEnumerable (and IEnumerable(Of T)), you’ll find that there are plenty of very interesting extension methods. One of them is the Cast() extension method. What does this extension method do? It provides a way to convert an IEnumerable(Of T) to an IEnumerable(Of U)….


Understanding LINQ

Note : I plan to post this blog on the VB team blog eventually. However, because of the length and complexity, I’m posting this up on my blog for now to hopefully get some eyes on it so that I won’t make a fool of myself on the team blog 🙂 Please feel free to…


Creating a class that has an anonymous type as a field

Here’s another way to use the generic parameter trick to get an anonymous type as a field. The other day, I was trying to store the result of a lambda expression in a field, but the lambda was typed as Func(Of <anonymoustype>) and since there is no type inference for fields, and I didn’t want…


New England Code Camp

It’s official – I’ll be going to the New England Code Camp this weekend and presenting two talks on LINQ features and Visual Basic. I hope that it will be a blast, and if you’re around the New England area, I hope you drop by! The two talks I have planned are “LINQ Fundamentals” (all…


Lambda expressions article published on MSDN Magazine

Hey guys, just a quick note to let you know that my article on lambda expressions has been published on MSDN magazine. I’ll be updating this blog (actually, probably the VB team blog) with more information on lambda expressions that I didn’t have time to get into the article. Hope you enjoy! In the mean…


Some updates about me

Sorry for the lack of posts recently; many things have converged within the last 2 – 3 months. First, there was TechEd back in June in Orlando; it was a great time had by all, and I hope that you guys are as excited about the new VB9 language features and VB product experience as…


Getting SQL Express to work nicely with Visual Studio 2005

I just spent the last 4 hours getting my machine ready for a user group demo; I was trying to get SQL Express setup so that I could do a LINQ to SQL demo; what a painful 4 hours! I will try to document things that I discovered along the way here so that you…


Partial methods for Visual Basic

One of the new features that we are adding to the language is the concept of a private partial method. In order to discover the rationale behind this feature, let’s consider a scenario where a designer generates some code and wishes to allow the user to customize certain behavior at certain points in the generated…


Anonymous Types and Object Identities

One of the recent changes we made to anonymous types was to allow the syntax to convey the notion of object identity. Paul (our architect) has a blog post on this topic, and I wanted to add a little bit to what he said with a few examples. The C# team decided to make anonymous…