日期:2014-05-17 浏览次数:20802 次
public class XmlHelper
{
public List<T> LoadXml<T>(string path) { }
public void SaveXml<T>(string path) { }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
using System.Diagnostics;
namespace XmlRefl
{
class Program
{
static void Main(string[] args)
{
List<XCls> cls1 = new List<XCls>(){
new XCls()
{
Id = 12345,
Name = "X-Man",
}};
XmlHelper hlper = new XmlHelper();
hlper.SaveXml("xcls.xml", cls1);
Process.Start("xcls.xml");
cls1.Clear();
cls1 = hlper.LoadXml<XCls>("xcls.xml");
Console.WriteLine("Count=" + cls1.Count);
Console.ReadLine();
}
}
public class XCls
{
public int Id { get; set; }
public string Name { get; set; }
}
public class XmlHelper
{
public List<T> LoadXml<T>(string path)
{