dhemue1930
New Member
ive got two selfmade Classes.The first Class is used by the second class. This is the first class i made:\[code\][Serializable]public class myListItemClass{ [XmlAttribute("Point")] private Size _point= new Size(0, 0); public Size PatternSize { get { return _point; } set { _point= value; } } [XmlAttribute("Length")] private Int32 _length = 0; public Int32 Value { get { return _length ; } set { _length = value; } } //* * Functions and such things *//}\[/code\]and this is the second class i made:\[code\][Serializable]public class mySequence : List<myListItemClass>{ [XmlAttribute("ID")] private Int32 _id; public Int32 ID { get { return _id; } set { _id= value; } } [XmlAttribute("Name")] private String _name; public String Name { get { return _name; } set { _name= value; } } //* * Functions and such things *//}\[/code\]my Serialization Method looks as follows:\[code\]public void SaveSequenceToFile(String filename,mySequence sequence) { XmlSerializer serializer = new XmlSerializer(typeof(mySequence)); TextWriter textWriter = new StreamWriter(filename); serializer.Serialize(textWriter, sequence); textWriter.Close(); }\[/code\]sadly the content of the xml file is not as expected. This is how it looks (had to replace braces because of display error):\[code\]<?xml version="1.0" encoding="utf-8"?><ArrayOfMySequence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <myListItem> <Point> <Width>8</Width> <Height>6</Height> </Point> <Length>1</Length> </myListItem> <myListItem> <Point> <Width>4</Width> <Height>4</Height> </Point> <Length>2</Length> </myListItem></ArrayOfMySequence>\[/code\]The String and Integer of the mySequence Class are not serialized. Can anybody please tell me how to accomplish this task? Now 4 Hours of googeling couldnt help me. I hope someone here knows an answer.