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 Thursday, March 11, 2010 10:06:31 PM (Pacific Standard Time, UTC-08:00)
If you're interested in learning F#, this is the most comprehensive book available. The text is well written and the examples are instructive. And after all, the author is the inventor of F#.
Because this book provides source code in Standard ML, it's a fantastic resource for learning F#. One bit of warning: this book does not teach classic data structures. While structures such as binomial heaps and red-black trees are presented, it is assumed that the reader already knows and understands them.
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.