Hello again, X-mas celebrants! I have just one last verse in my
carol to make all of
Studio 2008 experiences bright. Don't let your hearts be saddened because my
song is drawing to a close. After today, a new year filled with its own
code blessings will be upon us.
My last offering is a simple one—a
really. It's one last refactoring targeted at
And so, it is with a heavy heart that I begin the last verse of the "Twelve
Days of Refactor! X-mas..."
"On the twelfth day of X-mas my true love (DevExpress)
gave to me..."
Extract XML Literal to Resource
In my opinion, the most compelling new feature of
Visual Basic 9 is
We've already seen how
can be used to manipulate XML Literals to great effect, saving literally
keystrokes. However, sometimes we don't want to dynamically build XML. Sometimes
we simply want to consume a chunk of raw XML.
Dim lBook = <book isbn="12252007">
<title>Refactoring: The True Meaning of X-mas</title>
If we're not adding embedded expressions to the above XML literal, it really
belongs in a resource file. However, moving that XML to a resource is a terrible
provides the Extract XML Literal to Resource refactoring. When applied to the
code above, Extract XML Literal to Resource produces the following:
Dim lBook = XElement.Parse(My.Resources.XMLFile)
When compared to the acrobatics we've
perform on XML Literals, this refactoring might seem like a very small thing. It
may be simple, but it's incredibly helpful when you need it. The first time that
you attempt to move an XML Literal to a resource for translation purposes or any
other reason, you'll be thankful that you have Extract XML Literal to Resource
to do the job for you.
Check Out This Screencast to See Everything that Extract
XML Literal to Resource Handles for You!
And so ends my song. We've taken a merry sleigh ride through many
of the new language features available in
2008, and we've seen how
can help you leverage those features today. It's been my
distinct pleasure to be your guide on this journey.
Before I take my leave, I have one small piece of advice. If you've been
waiting impatiently for the other tool to support for
2008, remember that
has been there since the very first beta. No matter what that tool vendor may
try to tell you,
Visual Studio 2008 was not a surprise. Everyone had
more than a year to prepare. The only ones taken by surprise were those who
weren't paying attention.
And with that, I wish you a continued happy holiday season and hope Refactor! Pro
can make your new year bright!
Happy New Year!