i ont ces trois types, par exemple:C# Désérialisation ordre
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));
}
}
au moment de la désérialisation d'un objet Type1, par exemple d'abord un objet type3 est désérialisé puis type1 est desrialized puis type2. J'ai besoin de cette discipline: Au premier type1 dessinez, puis tapez 2, puis tapez 3. comment puis-je le faire? note de bas de page: Ce n'est pas mon code et je ne le teste pas, mais mon code est comme ça. en raison de son volume je ne pot dans mon post ...
pourquoi l'ordre de la matière désérialisation? – taylonr
en raison de la récupération d'une relation parent-enfant ... – qiback