Wrox Home  
Search P2P Archive for: Go

  Return to Index  

dotnet_windows_app_design thread: Serialisation in C#


Message #1 by "CA Mackay" <colin.angus.mackay@d...> on Thu, 6 Feb 2003 18:56:22 -0000
Hello,

I want to serialise some classes with C# using the XmlSerializer. However I
am concerned that the class stucture is too complex and I am going to end up
with a huge file with duplicate entries everywhere.

Here's an example.

An instance of class A can contain an array of more instances of class A. It
also contains a list of instances of class B. Think of class A like a folder
and class B like a file. Class A objects also know what their parent is.

Class B contains parent elements (which can be a class A object or a class B
object [like a shortcut]) and possibly more children class B.

To cut a long story short most things can reference most other things (there
is a bit of business logic to keep everything tidy and in order).

Now, because these objects have parents and children how do I serialise it
all without ending up with an XML file infinitly large due to recursion? I
do hope there are some ideas to keep all this in check. I have two things to
overcome - (1) Circular references and (2) an object may be serialised
before or after its parents or children, so how can it all be linked back
up?

Any ideas would be great.

Thanks,
Colin.


  Return to Index