M
Mark Saccomandi
Hi,
I'm extending a serializable class I made. The new class adds some features
that cannot be serialized automatically, this means that I have to implement
the ISerializable interface for my new class. What happens is that I do
serialize what I have written within the GetObjectData method, but now I do
not get to automatically serialize the data from my parent class.
Is there a way to serialize automatically the properties from my parent
class and then to serialize manually only what I have added in the derived
class?
Here's a sample of the code:
[Serializable]
public class OperDataSocketIn : Operator, ISerializable
{
[NonSerialized]
private DataSocket dataSocketIn;
...
private OperDataSocketIn( SerializationInfo info, StreamingContext
context)
{
dataSocketIn =new DataSocket();
dataSocketIn.Url= info.GetString("Url");
}
void ISerializable.GetObjectData(SerializationInfo info,
StreamingContext context)
{
info.AddValue("Url", dataSocketIn.Url);
}
...
}
Using this code after deserializing I get an object that has empty values
except for dataSocketIn.Url.
Thanks, Mark Saccomandi
I'm extending a serializable class I made. The new class adds some features
that cannot be serialized automatically, this means that I have to implement
the ISerializable interface for my new class. What happens is that I do
serialize what I have written within the GetObjectData method, but now I do
not get to automatically serialize the data from my parent class.
Is there a way to serialize automatically the properties from my parent
class and then to serialize manually only what I have added in the derived
class?
Here's a sample of the code:
[Serializable]
public class OperDataSocketIn : Operator, ISerializable
{
[NonSerialized]
private DataSocket dataSocketIn;
...
private OperDataSocketIn( SerializationInfo info, StreamingContext
context)
{
dataSocketIn =new DataSocket();
dataSocketIn.Url= info.GetString("Url");
}
void ISerializable.GetObjectData(SerializationInfo info,
StreamingContext context)
{
info.AddValue("Url", dataSocketIn.Url);
}
...
}
Using this code after deserializing I get an object that has empty values
except for dataSocketIn.Url.
Thanks, Mark Saccomandi