Ilist 怎么写入xml
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Property pr = new Property();
XmlSerializer serializer = new XmlSerializer(typeof(IList));
pr.GetId = 1;
pr.GetName = "aa";
pr.GetTypes = "bb";
IList list = new List<Property>();
list.Add(pr);
TextWriter writer = new StreamWriter("TextXML.xml");
serializer.Serialize(writer, list);
writer.Close();
}
}
public class Property
{
private int id;
public int GetId
{
get { return id; }
set { id = value; }
}
private string name;
public string GetName
{
get { return name; }
set { name = value; }
}
private string type;
public string GetTypes
{
get { return type; }
set { type = value; }
}
}
}