Serialize Object to String - CSharp System.Xml

CSharp examples for System.Xml:XML Serialization

Description

Serialize Object to String

Demo Code


using System.IO;//w  w  w  .jav a  2  s.  co  m
using System.Xml.Serialization;
using System.Collections.Generic;
using System;

public class Main{
        public static string Serialize<T>(T obj)
    {
      XmlSerializer<T> serializer = new XmlSerializer<T>();
      return serializer.Serialize(obj);
    }
}

Related Tutorials