Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » XML » XML/XSLT » Downloads
 
Add your own
alternative version

Load and save objects to XML using serialization

, 1 Sep 2006
A C# program to demonstrate loading and saving an object to an XML file using XML serialization encapsulated in a wrapper class.
xml_serialization_facade_cs2003_src.zip
XML_Serialization_Facade_C#2003_src
App.ico
bin
Debug
Load-Save objects to XML.csproj.user
Load-Save objects to XML.suo
xml_serialization_facade_cs2005_src.zip
XML_Serialization_Facade_C#2005_src
App.ico
bin
Debug
Load-Save objects to XML.csproj.user
Load-Save objects to XML.suo
xml_serialization_facade_c_2005_demo.zip
XML_Serialization_Facade_C#2005_demo
App.ico
bin
Debug
Load-Save objects to XML.csproj.user
obj
Debug
temp
TempPE
xml_serialization_facade_c_2005_src.zip
App.ico
Load-Save objects to XML.csproj.user
obj
Debug
TempPE
xml_serialization_wrapper_demo.zip
XML_Serialization_Wrapper_Demo
App.ico
bin
Debug
Load-Save objects to XML.csproj.user
xml_serialization_wrapper_src.zip
XML_Serialization_Wrapper_Src
App.ico
bin
Debug
Load-Save objects to XML.csproj.user
<?xml version="1.0" encoding="utf-8"?>
<Customer xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" DateTimeValue="2006-05-22">
  <CustomerID>12</CustomerID>
  <CustomerName>Joe Bloggs</CustomerName>
  <Age>28</Age>
  <Hobbies>
    <Hobby>Golf</Hobby>
    <Hobby>Tennis</Hobby>
    <Hobby>Reading</Hobby>
  </Hobbies>
  <EmailAddresses>
    <EmailAddress Address="joe.b@disc1software.com" Destination="Business" />
    <EmailAddress Address="joe.b@athome.com" Destination="Home" />
    <EmailAddress Address="joe.b@hotmail.com" Destination="Other" />
  </EmailAddresses>
  <Picture>/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAYEBAQFBAYFBQYJBgUGCQsIBgYICwwKCgsKCgwQDAwM
DAwMEAwODxAPDgwTExQUExMcGxsbHCAgICAgICAgICD/2wBDAQcHBw0M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loads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

T-C
Web Developer
New Zealand New Zealand
TC is a software developer with a Degree in Information Systems and commercial experience ranging from C DLL's to N-Tier Web applications.

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 1 Sep 2006
Article Copyright 2003 by T-C
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid