Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: XML Serialization of an Object - C#

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: Thu, Dec 03, 2015, 3:08 PM


Overview

This article demonstrates how to serialize an object to XML

Sample Code

var myObject = new MyClass();
var xs = new XmlSerializer(myObject.GetType());
string resultXml;

using (var sw = new StringWriter())
{
    xs.Serialize(sw, myObject);
    resultXml = sw.ToString();
}

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.