I did the Serialization as follows:
FileStream fs = new FileStream(GlobalClass.SyncLog, FileMode.OpenOrCreate, FileAccess.Write);
IFormatter formatter = new BinaryFormatter();
try
{
//SyncTable is the Hashtable to serialize
formatter.Serialize(fs, SyncTable); //save entire HashTable
}
catch(SerializationException e)
{
...
I have no Assembly-information of any kind stored in this Serialization-file.
The key of the HashTable is a String, the value is a class of my own: SyncDirClass:
public class SyncDirClass : ISerializable
{
public SyncDirClass() {}
public String Status;
public String DestDir;
public DateTime dtModTime; //date and time of last modification
// The security attribute demands that code that calls
// this method have permission to perform serialization.
[SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)]
void ISerializable.GetObjectData(
SerializationInfo info, StreamingContext context)
{
info.AddValue("Status",this.Status);
info.AddValue("DestDir",this.DestDir);
info.AddValue("ModTime", this.dtModTime);
}
// The security attribute demands that code that calls
// this method have permission to perform serialization.
[SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)]
public SyncDirClass(SerializationInfo info, StreamingContext context)
{
this.Status = info.GetString("Status");
this.DestDir = info.GetString("DestDir");
this.dtModTime = info.GetDateTime("ModTime");
}
public override String ToString()
{
return "Status=" + this.Status + "// DestDir=" + this.DestDir + "// ModTime=" + this.dtModTime.ToString();
}
}//public class SyncDirClass : ISerializable
What is wrong or missing?
Thanks for the help!!
nick;