BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

LINQ to XSD is Back

| by Jonathan Allen Follow 5 Followers on Feb 25, 2008. Estimated reading time: less than one minute |

Like LINQ to XML, LINQ to XSD is a provider for querying XML data. But unlike the former, LINQ to XSD is designed to be type safe. As the name implies, it used XSD files to generate strongly typed classes.

LINQ to XSD is especially important to C# developers who currently have to sprinkle their XML code with type casts. (VB developers can side step this with Option Strict Off.) An example of this can be seen in Fabrice's weblog:

//LINQ to XML
from item in purchaseOrder.Elements("Item")
select (double)item.Element("Price") * (int)item.Element("Quantity")

//LINQ to XSD
from item in purchaseOrder.Item
select item.Price * item.Quantity

LINQ to XSD was last available for VS 2008 Beta 1, a version that was incompatible with later betas.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

XML in VB by Stefan Wenig

It should be noted that VB already supports this (and more, like axis operators) via the import statement:

Imports <xmlns:ns="http://NewNamespace">

It's therefore not necessary to rely on option strict off when using VB9 to access schema-typed XML. My new favorite DSL for XML access ;-)</xmlns:ns="http://newnamespace">

Re: XML in VB by Stefan Wenig

Oh my, infoq is XML-aware too and "intelligently" adds closing tags...

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT