If all the types have been marked with the [Serializable()] tag, then
the following is the simplest approach:
private MyType _MyObject;
private void PersistToFile() {
BinaryFormatter binaryformatter = new BinaryFormatter();
_FileStream.Position = 0;
binaryformatter.Serialize( _FileStr
th me here).
Peter
-Original Message-
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On 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...
I,
By default, the XmlSerializer will be able to serialize your class, with
no modifications to it (which means, no extra attribute).
However, it's not going to serialize an IDictionnary (HashTable,
SortedList, etc). In that case, your collection should implement
ICollection (all un-keyed collect
T 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 colle
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