Extract XML Literal to Resource (VB)
Extracts a selected XML literal to a new or existing resource file. Extracted code is replaced with the appropriate resource extraction statement.
This refactoring encourages XML code reuse, as well as code and data separation.
- when the caret is on an XML tag. In this case, this tag and its children will be extracted.
- when an XML code fragment is selected. In this case, the selected fragment will be extracted.
- when the caret is on a variable that is being assigned an XML code fragment. In this case, the entire right-side part of the assignment will be extracted.
This refactoring is only available in Visual Studio 2008, in VB code.
Dim MyXElement As XElement = _ <contact> <name>Patrick Hines</name> <phone type="home">206-555-0144</phone> <phone type="work">425-555-0145</phone> </contact>
Dim MyXElement As XElement = _ XElement.Parse(My.Resources.MyXMLElementValue)