Rauland
Apr 12th, 2007, 08:29 AM
Hi,
Iīd like to serialize a List<T> to XML.
Letīs say I have;
Class Person
{
,....
}
And another Class;
Class People
{
Private People()
{
}
Public void CreatePerson()
{
Person pr = new Person();
this.myPersonList.Add(pr);
}
List<Person> myPersonList = new List<Person>();
public List<Person> ReturnMyPersonListCollection
{
get
{
return myPersonList;
}
}
}
Okay, If I were to serialize this, I would get sth similiar to this;
(Asume that I have added these attributes,
[System.Xml.Serialization.XmlAttribute("")]
to the public properties of the Person Class).
<ReturnMyPersonListCollection>
<Person>,.....................</Person>
<Person>,.....................</Person>
<Person>,.....................</Person>
<ReturnMyPersonListCollection>
The problem is the outter tag ,<ReturnMyPersonListCollection>,
Iīd like to be able to change this tag to what ever Iīd like it to be,..
Thanks.
Iīd like to serialize a List<T> to XML.
Letīs say I have;
Class Person
{
,....
}
And another Class;
Class People
{
Private People()
{
}
Public void CreatePerson()
{
Person pr = new Person();
this.myPersonList.Add(pr);
}
List<Person> myPersonList = new List<Person>();
public List<Person> ReturnMyPersonListCollection
{
get
{
return myPersonList;
}
}
}
Okay, If I were to serialize this, I would get sth similiar to this;
(Asume that I have added these attributes,
[System.Xml.Serialization.XmlAttribute("")]
to the public properties of the Person Class).
<ReturnMyPersonListCollection>
<Person>,.....................</Person>
<Person>,.....................</Person>
<Person>,.....................</Person>
<ReturnMyPersonListCollection>
The problem is the outter tag ,<ReturnMyPersonListCollection>,
Iīd like to be able to change this tag to what ever Iīd like it to be,..
Thanks.