Visual Basic 2008 Ships!!! (Amanda Silver)

Visual Basic 2008 Ships!!! (Amanda Silver)

Rate This
  • Comments 9

Hooray! Today we’ve finally shipped Visual Studio 2008, previously known as “Orcas”, previously known as some symbol which doesn’t have an ascii representation. We’ve come a long way, but it’s been a great ride. In his blog, Soma mentions many of the flagship features at a high-level that will undoubtedly make the every developer and head of IT salivate, but this blog is about Visual Basic. :)

This is a tremendous release for Visual Basic users everywhere as it’s the first to introduce query expressions and XML as a first class data-type. Not only does this make Visual Basic the most productive choice for programming data-centric applications, it also makes us VB developers the envy of many an alpha-geek. If you'd like to just try it out -- be sure to check out Visual Basic Express which comes with all the features I talk about below.

With query the entire .NET frameworks become a queryable data source. You can now query against anything available in the .NET Frameworks – the registry, file system, live processes, etc. For example, the code below queries against the running processes and returns those with a thread count greater than 10, orders them by the thread count:

        Dim query = From proc In Process.GetProcesses _
            Let ThreadCount = proc.Threads.Count _
            Where ThreadCount > 10 _
            Order By ThreadCount _
            Select proc.ProcessName, proc.Id, ThreadCount

Using the LINQ to SQL Object-Relational Mapping framework, you can query against a SQL database as though it was just another collection of objects exposed by the frameworks. The following query finds all the products that have been discontinued, groups them into categories, and finds the total number of units in stock for each category:

        Dim db As New NorthwindDataContext(My.Settings.NORTHWNDConnectionString)
        Dim query = From prod In db.Products _
                    Where prod.Discontinued = True _
                    Group By prod.CategoryID _
                    Into Count(), NumInStock = Sum(prod.UnitsInStock) _
                    Join cat In db.Categories On cat.CategoryID Equals CategoryID _
                    Select cat.CategoryName, Count, NumInStock

Unlike writing huge SQL query strings, I get immediate feedback on the query I write.

Intellisense:

clip_image002

Syntax checking:

clip_image004

Schema checking:

clip_image006

I can use the same query language (VB!) to query against relational databases, XML, and collections of objects – I don’t need to learn any domain specific language, VB gives me access to all! It’s really easy for me to join across domains (I’ll take that up in a later blog post.)

With XML as a first class data-type, Visual Basic becomes a full XML transform language. But it’s also really easy for me to project to XML from my SQL database:

        Dim query = From prod In db.Products _
            Where prod.Discontinued = True _
            Group By prod.CategoryID _
            Into prodGroup = Group, NumInStock = Sum(prod.UnitsInStock) _
            Join cat In db.Categories On cat.CategoryID Equals CategoryID _
            Select <Products>
                       <Category CategoryID=<%= CategoryID %> CategoryName=<%= cat.CategoryName %>>
                           <%= From prod In prodGroup _
                               Select <Product Price=<%= prod.UnitPrice %>><%= prod.ProductName %></Product> %>
                       </Category>
                   </Products>

Last but not least, for those of you who aren’t so excited about the LINQ (Language INtegrated Query) project, Visual Basic 2008 comes with a tremendous improvement in the Intellisense experience overall. One of our MVPs said that he literally types two characters and hits tab, two characters, tab – it’s as though the code writes itself!

Obviously, we’re very excited about this release and hope it meets you with open arms eager to embrace the productivity! If you're ready to go to the next level and dig in, be sure to check out our learning pages and How-Do-I videos which walk you through these features and so much more.

Tomorrow I’ll blog about the least often mentioned goodies hidden in Visual Basic 2008 so that you can become the guru master of VB9. ‘Til then…

Leave a Comment
  • Please add 4 and 1 and type the answer here:
  • Post
  • This is fantabulous!  I am planning to get a new machine soon and will be installing this ASAP. Looking forward to tomorrows post.

  • Visual Studio 2008을 위하여 수십개의 팀에서 쏟아져나온 수백가지의 새로운 기능들을 일목요연하게 정리한다는 것은 쉽지 않은 일일 것입니다. 그래서 각각이 정리한 새 기능들

  • Visual Studio 2008을 위하여 수십개의 팀에서 쏟아져나온 수백가지의 새로운 기능들을 일목요연하게 정리한다는 것은 쉽지 않은 일일 것입니다. 그래서 각각이 정리한 새 기능들

  • Great news!

    Could you give us a quick list of what is new since beta 2?

  • Yesterday I promised to post about the hidden gems in Visual Basic and Visual Studio 2008 that you haven&#8217;t

  • Yesterday I promised to post about the hidden gems in Visual Basic and Visual Studio 2008 that you haven&#8217;t

  • I guess I've been working too hard on getting the product ready to ship to notice that Bart has put together

  • I guess I&#39;ve been working too hard on getting the product ready to ship to notice that Bart has put

  • Thanx Microsoft...Thanx VB.NET Team..

    i'll get a new machine soon...and i'll try all of this things.

    but i need some helps to more ameliorate myself xd

    Please contact me pleaaaaaaaaase !

    Abdo_Fila@hotmail.com

Page 1 of 1 (9 items)