Sometimes when integrating between external systems or reading XML from I/O, you might need to deserialize that XML string into a runtime object. Because converting an XML into an object will give lots benefits rather than parsing the XML and then extracting/manipulating nodes.
Luckily, in Visual Studio 2013 there is a new feature that can create a class with its properties on behalf of you according to the passed XML string. So rather than manually writing a class with lots of properties to map your XML structure, Visual Studio 2013 does it for you.
Here is a simple XML sample:
Open a new instance of Visual Studio 2013, create a new C# Project select Console Application.
Change the Target framework to .Net 4.5, this is really important, because this feature only works .Net 4.5 projects.
Add a new Class to the project by right-click the project and go to Add and then select Class.
Keep the existing class name because it will automatically change as we will see now.
Completely remove this code from the Class file and place your cursor between the namespace curly braces like this:
Now from the main menu, go to Edit > Paste Special > Click Paste XML as Class.
And Voila, you have a C# class that represents your pasted XML string. Now you can deserialize your XML strings into memory using an instance of your class.
This feature also applies for JSON and it works if you have Visual Studio 2012 Update 2.