Skip to content

Instantly share code, notes, and snippets.

@lmatt-bit
Created April 3, 2014 07:20
Show Gist options
  • Select an option

  • Save lmatt-bit/9949743 to your computer and use it in GitHub Desktop.

Select an option

Save lmatt-bit/9949743 to your computer and use it in GitHub Desktop.
Serialize object to xml(C# version)
using System;
public class clsPerson
{
public string FirstName;
public string MI;
public string LastName;
}
class class1
{
static void Main(string[] args)
{
clsPerson p=new clsPerson();
p.FirstName = "Jeff";
p.MI = "A";
p.LastName = "Price";
System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(p.GetType());
x.Serialize(Console.Out, p);
Console.WriteLine();
Console.ReadLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment