Joel
4Penny.net
Points: 10550

11/18/2011 8:06:20 AM

System.XML.Serialization Serialize a Class into an XML Document

* This article, and all our great .NET Development documentation, Is available on the .NET Development menu

Here is a simple code example showing how to take a VB Class object and use Xml.Serialization to turn it into an XML string. I had a little trouble finding this code because all the examples wanted to write the XML to disk using a StreamWriter… I needed it in memory as a string 

The resulting string looks like this:

4Penny.net
Version: Unknown or N/A
Section: .NET Development
Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3