writexml readxml 格式不对
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.IO;
using System.Runtime.Serialization;
namespace testxmlsz
{
    class Program
    {
        static void Main(string[] args)
        {
            
            myclass[] ms = { new myclass(1),new myclass(2),new myclass(3)};
            XmlSerializer xsz = new XmlSerializer(typeof(myclass[]));
            MemoryStream mstream = new MemoryStream();
            xsz.Serialize(mstream, ms);
            byte[] bs = mstream.ToArray();
            string strxml = System.Text.Encoding.UTF8.GetString(bs,0,bs.Length);
            byte[] bd = System.Text.Encoding.UTF8.GetBytes(strxml);
            mstream =new MemoryStream(bd);
            object o = xsz.Deserialize(mstream);        }
    }
    [Serializable]
    public class myclass:System.Xml.Serialization.IXmlSerializable,System.Runtime.Serialization.ISerializable
    {
        public myclass() { a = 0; }
        public myclass(int temp) { a = temp; }
        public int a;
        #region IXmlSerializable 成员        public System.Xml.Schema.XmlSchema GetSchema()
        {
            throw new Exception("The method or operation is not implemented.");
        }        public void ReadXml(System.Xml.XmlReader reader)
        {
            this.a = System.Xml.XmlConvert.ToInt32(reader.ReadElementString());
        }        public void WriteXml(System.Xml.XmlWriter writer)
        {
            writer.WriteString(System.Xml.XmlConvert.ToString(a));
            
        }        #endregion        #region ISerializable 成员        void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
        {
            
        }        #endregion
    }
}