Spot the Bug! – The Key to using Anonymous Types (Jonathan Aneja)

This one’s going to be long, but for those of you who’ve felt the first 3 in this series were too easy I promise this one’s tougher J.   Let’s say you want to list all the customers from a table in a ComboBox, and update the UI based on which one is selected.  To… Read more

Dynamic Searching using LINQ – Dataset + Joins

About two years ago I posted some code that shows how to dynamically construct LINQ queries at runtime.  On average there’s a couple questions per month about trying it in some edge case, and usually the support already exists within the API.  Recently though someone posted a question that has to do with Datasets and… Read more

VB XML Cookbook, Recipe 6: Writing an XSLT Transform in VB (Doug Rothaus)

Most XSLT programmers are familiar with this XSLT transform to copy an XML file. <?xml version=“1.0“ encoding=“utf-8“?> <xsl:stylesheet version=“1.0“ xmlns:xsl=“http://www.w3.org/1999/XSL/Transform“>     <xsl:output method=“xml“ indent=“yes“/>       <xsl:template match=“@* | node()“>         <xsl:copy>             <xsl:apply-templates select=“@* | node()“/>         </xsl:copy>     </xsl:template> </xsl:stylesheet> This XSLT is commonly used for identity transforms as it allows you to… Read more

VB 2008 Language Deep Dive – Presentation Materials (Jonathan Aneja)

Last week I got the chance to visit the Toronto .NET User Group and give a talk on all the great new language features in VB2008.  It was great to see so much excitement around LINQ and especially XML Literals!   The slides and demo code are posted at the link below; here’s the session… Read more

VB 2008 IDE Tips & Tricks Presentation Materials (Lisa Feigenbaum)

Last week I went on a user group tour around Southern California. I’ve uploaded the materials from my talk: Powerpoint presentation Solution at the Start of the Demo Solution at the End of the Demo You can find these all posted together on the following Code Gallery page. The demo requires installation of Refactor!, which… Read more

How LINQ to Dataset works in VB (Jonathan Aneja)

LINQ at its core requires any data source to be queryable, which basically means it must implement IEnumerable.  (It’s actually a bit more complicated than that, for a full explanation see section 11.21.2 of the Visual Basic 9.0 Language Specification).  Now when working with LINQ to Dataset we have a problem: DataTable does not implement… Read more

Using LINQ to Dataset in an .aspx page (Jonathan Aneja)

Recently I got a customer question about how to use LINQ to Dataset in an .aspx file.  The compiler was complaining that it couldn’t find the AsEnumerable method that allows LINQ to work over a DataTable (“AsEnumerable is not a member of ‘DataTable’”).  The code he sent looks correct, so why is the compiler not… Read more

VB XML Cookbook, Recipe 5: The “Halloween” Problem (Doug Rothaus)

In the last two XML cookbook entries, we talked about the technique of using the ReplaceWith method to perform an identity transform. While this technique may meet your needs, it can introduce a problem in your code commonly referred to as the “Halloween” problem. Let’s take a look at what the problem is, and how… Read more

VB XML Cookbook, Recipe 4: Get Inner XML from the Nodes Property (Doug Rothaus)

Recipe 3 showed one way to work with mixed XML content using the XML Descendant axis property and the ReplaceWith method. This is one way to do an identity transform and we’ll look at another method in a later post. There is a key capability not mentioned in Recipe 3 that you will need for… Read more

VB XML Cookbook, Recipe 3: Identity Transforms (Doug Rothaus)

An identity transform in XSLT does just what the name implies: replace the identity of an element or attribute with a new identity. Identity transforms are especially critical when dealing with XML markup that is less rigid in its structure. Consider a documentation structure for news articles. Whenever a title is referred to within an… Read more