
Today we completed another major milestone in the resolver implementation of the SyntaxEditor .NET Languages Add-on for WPF/Silverlight: support for resolving extension methods in C# and VB.
If you are interested in learning about other recent .NET Languages Add-on progress, please see our previous blog posts.
Let’s see some samples…
Extension Methods Defined in Code
In this screenshot, we’ve defined a ToInt32 extension method in code. Then down below we declare a num variable using the extension method invocation as an initializer.

When we hover over the WriteLine method, the resolver properly determines that num is an int (per the extension method call in its initializer) and then picks the correct WriteLine overload.
Let’s see a similar extension method define in VB code:

When hovering over ToInt32, we see that the extension method defined in code is picked up.
LINQ Extension Methods
Above in the code, we added using statements to import the System.Linq namespace. We declare an array variable, which is an int array.

When we hover over the Average method call on the array variable, the resolver identifies that array implements IEnumerable<int> and thus picks the correct LINQ extension method from Enumerable.
Now let’s get even more complex. We’ll declare a list variable that is a constructed generic type with a nullable double type argument.

When we hover over the Average method call on the list variable, the resolver identifies that list implements IEnumerable<double?> and thus picks the correct LINQ extension method from Enumerable. Note that the result for this extension method is double? instead of double.
Just for comparison, now lets explicitly call that same extension method:

You can see how quick info now properly reveals the first parameter to the method.
Summary
Over the past few blog posts, we’ve see how new functionality gets layered on top of previously-added resolver functionality. For instance in this post, we used type inference, generic type construction, and overload resolution features that were added in the past several weeks. Everything is coming together very nicely.
We still have some more features to work out before we can get the automated quick info features out into the public, but we hope to post a call for closed beta testers soon so keep an eye on our blog.