当我们处理序列化时,在类的开头(命名空间之后和类之前)使用 [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;
}
}
}