Click to See Complete Forum and Search --> : Serialization of class with dynamic arrays


FaisalJ
April 21st, 2003, 07:49 AM
Hello!

Im looking for examples of how to do Serialization of a class that has dynamic arrays. Im not sure what to write in the constructor of the Serializable class and in the GetObjectData function.

Thanks

pareshgh
April 21st, 2003, 05:18 PM
you could try storing as the XML Serialization file.

Paresh

pareshgh
April 21st, 2003, 05:26 PM
or giving sample,

something like this,
------------
string[] Str = new String[4]; // consider dynamic array
for(int i=0; i<4; i++)
{
// initialize the array
}

XmlSerializer serializer = new XmlSerializer(typeof(strPath)); // some str

FileStream stream = new FileStream("arr.txt",FileMode.Create);
serializer.Serialize(stream, lp, null);
stream.Flush();
stream.Close();

hope this helps,
Paresh