Silicon Valley Code Camp

It’s been a long time since I’ve posted : we’ve been very busy working hard on the next version of Visual Basic (the next version of Visual Studio will officially be called Visual Studio 2010). I’m really excited about the work we’ve done, and can’t wait to share it with you. But for some immediate…


VB expression trees – coalesce operator

Hey there! In this post, I’ll continue describing some of the things that are interesting about the VB compiler, especially related to expression trees and the consumption of expression trees in your LINQ provider. Again, this may not be too interesting if you aren’t writing a LINQ provider, but I hope you read on anyway…


Checking generic parameters for Nothing/null

Consider the following code fragment: Module Module1 Sub Foo(Of T)(ByVal x As T) If x Is Nothing Then End If End Sub Sub Main() Foo(10) End SubEnd Module The first thing you might ask is : “hey, how come the compiler allows me to check for Nothing? Isn’t that a reference comparison? There is no…


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…


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…