我刚刚熟悉 C# 中对象的序列化。我想知道反序列化构造函数是否被称为 INSTEAD OF 默认构造函数或 IN ADDITION TO。如果是 IN ADDITION TO,这些调用的顺序是什么?例如:
[Serializable()]
public class ReadCache : ISerializable
{
protected ArrayList notifiedURLs;
// Default constructor
public ReadCache()
{
notifiedURLs = new ArrayList();
}
// Deserialization constructor.
public ReadCache(SerializationInfo info, StreamingContext ctxt)
{
//Get the values from info and assign them to the appropriate properties
notifiedURLs = (ArrayList)info.GetValue("notifiedURLs", typeof(ArrayList));
}
}