【发布时间】:2014-03-03 14:17:59
【问题描述】:
问题是我有一个测试类和一个 TestVariable,我想序列化测试类而不序列化 TestVariable。:
public class TestClass
{
public int TestVariable
{
get;
set;
}
public int ControlVariable
{
get;
set;
}
public TestClass()
{
TestVariable = 1000;
ControlVariable = 9999;
}
}
执行序列化的代码:
public static void PrintClass()
{
new XmlSerializer(typeof(TestClass)).Serialize(Console.Out, new TestClass());
}
【问题讨论】:
标签: c# serialization