.NET XmlHelper帮助类
2021-06-29 21:06
标签:eof int end XML 帮助 cat ons base ret ++ 使用方法 .NET XmlHelper帮助类 标签:eof int end XML 帮助 cat ons base ret ++ 原文地址:http://www.cnblogs.com/qzxj/p/7140522.html public class Program
{
static void Main(string[] args)
{
Student stu1 = new Student() { Name = "okbase", Age = 10 };
string xml = XmlHelper.Serializer(typeof(Student), stu1);
Console.Write(xml);
Student stu2 = XmlHelper.Deserialize(typeof(Student), xml) as Student;
Console.Write(string.Format("名字:{0},年龄:{1}", stu2.Name, stu2.Age));
Console.ReadKey();
}
public class Student
{
public string Name { set; get; }
public int Age { set; get; }
}
///
public class Program
{
static void Main(string[] args)
{
Student stu1 = new Student() { Name = "okbase", Age = 10 };
string xml = XmlHelper.Serializer(typeof(Student), stu1);
Console.Write(xml);
Student stu2 = XmlHelper.Deserialize(typeof(Student), xml) as Student;
Console.Write(string.Format("名字:{0},年龄:{1}", stu2.Name, stu2.Age));
Console.ReadKey();
}
public class Student
{
public string Name { set; get; }
public int Age { set; get; }
}
}