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

namespace XSerTest
{
    public class XTest : IXmlSerializable
    {
        public int a;

        #region IXmlSerializable Members

        System.Xml.Schema.XmlSchema IXmlSerializable.GetSchema()
        {
            return null;
        }

        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            this.a = 1;
            while (reader.Read()) ;
        }

        void IXmlSerializable.WriteXml(XmlWriter writer)
        {
            writer.WriteElementString("value", "1");
        }

        #endregion
    }
    class Program
    {
        static void Main(string[] args)
        {
            XmlSerializer xs = new XmlSerializer(typeof(XTest));
            XTest x = new XTest();
            x.a=1;
            xs.Serialize(Console.Out, x);
        }
    }
}
