Created
April 3, 2014 07:20
-
-
Save lmatt-bit/9949743 to your computer and use it in GitHub Desktop.
Serialize object to xml(C# version)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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