【发布时间】:2012-10-20 03:02:03
【问题描述】:
当我们处理序列化时,在类的开头(命名空间之后和类之前)使用 [Serializable()] 有什么重要性?
我正在查看如下示例:
namespace MyObjSerial
{
[Serializable()] //Set this attribute to all the classes that you define to be serialized
public class Employee : ISerializable
{
public int EmpId;
public string EmpName;
//Default constructor
public Employee()
{
EmpId = 0;
EmpName = null;
}
}
}
【问题讨论】:
-
这个问题有XML和XAML标签;它们与问题有什么关系?对于 XML,如果是因为您要序列化为 XML,请编辑您的问题以包含该事实(这会使问题与可能的重复问题不同)。对于 XAML,我无法想象它是如何应用的。