using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Xml.Serialization; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { TextBox tb = new TextBox(); tb.Multiline = true; tb.Dock = DockStyle.Fill; this.Controls.Add(tb); Hoge h = new Hoge(); h.A = "aheahe"; h.B = "aheahe"; h.C = "aheahe"; h.D = new ArrayList(); //h.D = new string[3]; //h.D[0] = "sagesage"; //h.D[1] = "sagesage"; //h.D[2] = "sagesage"; h.D.Add("sagesage"); h.D.Add("sagesage"); h.D.Add("sagesage"); XmlSerializer x = new XmlSerializer(typeof(Hoge)); MemoryStream ms = new MemoryStream(); x.Serialize(ms, h); char[] text = Encoding.GetEncoding("Shift_JIS").GetChars(ms.ToArray()); ms.Close(); tb.Text = new String(text); } } public class Hoge { public string A { get; set; } public string B { get; set; } public string C { get; set; } //public string[] D { get; set; } public ArrayList D { get; set; } } }