quick and dirty is to walk your collection & create a dataset...
a table represents the collection, one row for each object in the collection
dataset.writexml is your friend...

or you could play with streams & formatters, and do a little extra work.

remember to account for any changes to the objects or collection between
versions of your app.  what happens if you try to load the objects that were
saved with a prior version of your app....and what happens if you try to
load the objects that wer saved with  a newer version.

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Knowlton,
Gerald F.
Sent: Monday, March 05, 2007 9:54 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] Saving the contents of a collection of
objects...


Hello all,

     I am looking for a solution to saving the contents of a collection
of objects to disk and then reading the data back into the collection.

        Suppose I have this collection called "Col" and each item is an
object called "ID". The ID object has two properties called "Name" and
"Address". The Col has 1 ... n number of ID objects. What I would like
to do is save the entire collection to a disk file and at some later
time, retrieve the values back into the collection. Naturally, the
program stops after the save and then, perhaps, the next day it is
started up again.

      I think the Serialization attribute plays a big part in this, but
frankly I don't know how to use that attribute nor be able to read the
serialized data back in.

      May I ask for someone to point me to some possible on line
solutions or if this is relatively simple, show me how it might be done?


Thank you very much.


Best regards,


Jerry Knowlton

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to