That compiles to something similar to this:
To me, this is a great example of what syntactic sugar should be all about: making tasks easier for developers. The VB team has gone to great pains to expose the new APIs in System.Xml.Linq in the most intuitive way possible. As a C# guy, I'm shamefully filled with deep feelings of VB envy.
Since I spend most of my time working on a wholly remarkable refactoring tool, you might be wondering what sort of refactoring support we have in store for these snazzy new XML literals. How about Extract Method?
Here's the preview hint that is displayed for Extract Method when the XML literal is selected:
And here's the successfully refactored code after applying Extract Method:
Notice the pieces that Refactor! must have to be in place to get this right:
We still have some work to do before Visual Studio 2008 reaches the RTM stage, but it looks like things are shaping up nicely.
Page rendered at Saturday, October 11, 2008 1:51:42 AM (Eastern Standard Time, UTC-05:00)