Thomas Levesque 6/12/2009

[C#] Parent/child relationship and XML serialization

Read Original

This technical article addresses a common C# design challenge: serializing objects with bidirectional parent-child references (like a parent with a list of children, each referencing the parent) to XML without circular reference errors. It explains the problem with XmlIgnore and broken relationships after deserialization, then presents an elegant solution involving a custom IChildItem<P> interface and a specialized ChildItemCollection<P,T> to maintain consistency.

[C#] Parent/child relationship and XML serialization

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week