Diego F. wrote:
I need to serialize a hash table in a file (xml or other), but I'm
new with all this and I don't know how to serialize. Can you put me a
piece of code to do this?
Regards,
Diego F.
Hi Diego,
A real easy way to do this is using a Soap Formatter (in
System.Runtime.Serialization.Formatters.Soap)
Create a stream (filestream or whatever) and use the serialize method
of the SoapFormatter.
i.e.
HashTable ht = new HashTable();
<snip - Code that populates the HashTable>
SoapFormatter sf = new SoapFormatter();
FileStream fs = new FileStream(TheFileName,FileMode.Create);
sf.Serialize(fs,ht);
(There is a Deserialize method as well to get it back.)
Rgds Tim.