Serilize to Xml : Xml Serialization « XML « C# / C Sharp






Serilize to Xml

 



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;

public static class SerilizationHelper
{
    public static void Serilize<T>(this T obj, string path)
    {
        var writter = File.OpenWrite(path);
        XmlSerializer serilizer = new XmlSerializer(typeof(T));
        serilizer.Serialize(writter, obj);
        writter.Close();
    }
}

   
  








Related examples in the same category

1.Serialize List of Objects
2.Use XmlSerializer
3.Set Xml Attribute when serilzation
4.Use XML Serialization with Custom Objects
5.XmlRootAttribute
6.Takes an XML file and exports the Object it holds
7.Converts an XML string to an object
8.Deserializes/Serializes an xml document back into an object
9.Deserialize with XmlSerializer
10.XmlSerializer Util
11.Xml Serialization Helper
12.Xml Serialization Helper 2
13.Tiny Xml Serializer
14.Xml Serialization Manager