[DataContract]
public class Customer
{
[DataMember]
public int customerID;
[DataMember]
public string customerName;
[DataMember]
public long phoneNumber;
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
//This is not getting called.
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
//This is not getting called.
}
[OnDeserializing]
private void OnDeserializing(StreamingContext context)
{
//I know this gets override by OnDeserialized method.
customerName = "This is set again in OnDeserializing.";
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
//This is working fine.
customerName = "This is set again in OnDeserialized.";
}
}
|