NEW VB LINQ CTP: Now live on MSDN!


By Amanda Silver


I’m very excited to announce that the next tech preview of Visual Basic 9.0 which includes support for Language INtegrated Query (codename LINQ) and XML integration atop the XLinq API is now available on the VB Future and the LINQ project websites. This is the result of a ton of hard work for a significant portion of the team and we’re very happy to get it out to you.


This is an additive release to that which came out in the PDC timeframe. It expands the XML integration in both the language and IDE, provides some editor features for the LINQ syntax, and enables DLinq for VB.

What’s new?

LINQ Intellisense: Query statements now have statement completion, Intellisense, and Pretty Printing to improve overall discovery and readability of VB queries.  

DLinq support: Previous tech previews of the LINQ CTP did not fully support leveraging the DLinq technology which is for querying against relational data stores, such as SQL Server. DLinq support in this release is limited in that only the working query syntax over objects will extend to DLinq.

Editing support for Xml Literals: The Visual Basic background compiler provides immediate feedback, with this release this support has extended to integrated XML. Specifically, XML literals are now automatically indented and XML literals plug into auto-correction. The XML literals are now completely colorized with customizability through the VS 2005 options, fonts & colors. 

Xml Late binding:

1.       Import Xml namespaces: Xml namespaces can be imported to the VB program using similar mechanism to importing CLR namespace. Xml namespace must have an alias. The following is an example for import of Xml namespace:
Imports ns = “”

2.       Accessing elements with namespaces: Once an Xml namespace was imported, you can use qualified identifiers to access elements with namespaces. The qualified identifiers are in the form of ‘Xml Namespace Alias’ + ‘::’ + ‘Element/Attribute name’. For example:

3.       Indexer for IEnumerable(Of T): An indexer was added to IEnumerable of any type. This enables easy access to any element from a generic IEnumerable, specifically for accessing the first XElement from the XElements collection that is returned from Xml late binding expressions. For example the following code prints the title of a book:

Imports ns = “”


Module Module1

  Sub Main()

    Dim book = _

      <Book xmlns=>

              <Title>Learning Programming Using Visual Basic</Title>


    Console.WriteLine( CStr( book.ns::Title(0) ) )

  End Sub

      End Module

What’s changed?

VB expression holes in Xml literals: The previous tech preview supported parentheses for expression holes inside the element tag. In this release we unified the syntax for expression hole and its now <%= %>   for element content and the element tag.

The reason we’re giving you these previews so early in the product cycle is that we need your feedback! The features in the CTPs are preliminary designs and are subject to change based on your thoughts; please blog, talk, write articles, gloat, gripe, rant and rave about these bits!  



Leave a comment

Feedback usabilla icon