X
Xavier J
I'm working with XML serialization of hierarchical objects such as the
following:
public class OuterClass
{
InnerClass _inner;
public InnerClass Inner
{ get {return _inner;}
set {_inner = value;}
}
}
public class InnerClass
{ OuterClass _parentouter;
[XmlIgnore()]
public OuterClass ParentOuter
{ get {return _parentouter;}
set {_parentouter = value;}
}
}
Okay, so without [XmlIgnore], if an OuterClass instance has property Inner
set, whose ParentOuter points back, then this won't XML serialize because the
serializer will be in an infinite loop between parent and child. Okay, so
I've added [XmlIgnore].
***During*** deserialization, how do I get an InnerClass's OuterParent
property to point back to the parent without? I really want to avoid writing
custom serializers cause I have lots of classes that interrelate like this.
Help!
following:
public class OuterClass
{
InnerClass _inner;
public InnerClass Inner
{ get {return _inner;}
set {_inner = value;}
}
}
public class InnerClass
{ OuterClass _parentouter;
[XmlIgnore()]
public OuterClass ParentOuter
{ get {return _parentouter;}
set {_parentouter = value;}
}
}
Okay, so without [XmlIgnore], if an OuterClass instance has property Inner
set, whose ParentOuter points back, then this won't XML serialize because the
serializer will be in an infinite loop between parent and child. Okay, so
I've added [XmlIgnore].
***During*** deserialization, how do I get an InnerClass's OuterParent
property to point back to the parent without? I really want to avoid writing
custom serializers cause I have lots of classes that interrelate like this.
Help!