1
我有这三种类型的,例如:C#反序列化订单
public class Type1 : ISerializable
{
public List<Type2> field2 { set; get; }
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("field2", field2, typeof (List<Type2>));
}
protected Type1(SerializationInfo info, StreamingContext context)
{
this.field2 = (List<Type2>) info.GetValue("field2", typeof (List<Type2>));
}
}
public class Type2 : ISerializable
{
public List<Type3> field3 { set; get; }
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("field3", field3, typeof (List<Type3>));
}
protected Type2(SerializationInfo info, StreamingContext context)
{
this.field3 = (List<Type3>) info.GetValue("field3", typeof (Type3));
}
}
public class Type3 : ISerializable
{
public string field;
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("field", field, typeof (string));
}
protected Type3(SerializationInfo info, StreamingContext context)
{
this.field = (string) info.GetValue("field", typeof (string));
}
}
在一个第一类型对象的反序列化时间,例如在第一一个TYPE3对象被反序列化,然后 TYPE1被desrialized然后类型2。我需要这门学科: 起初TYPE1 desrialize,然后键入2,然后键入3 我该怎么办呢? 脚注:这不是我的代码,我不测试,但我的代码是这样的。由于其体积的我不锅在我的帖子...
为什么反序列化的事情的顺序? – taylonr 2011-04-16 15:13:46
由于恢复一些亲子关系... – qiback 2011-04-16 15:15:15