serialization question

L

Lloyd Dupont

I need to have one of my class to be serialized.
However some of its member should not be, but they they should be
initialized to correct values.

sort of

[Serializable]
class Document
{
int aField;
[NonSerialized]
List<Stuff> stuff;
}

however even though List stuff should not be serialized, it should be
initialized to new List<Stuff>
how do I do that?
I believe the constructor is not called during binar deserialization....
 
L

Lloyd Dupont

don't worry, found it in the documentation:
OnDeserializedAttribute
OnDeserializingAttribute
OnSerializedAttribute
OnSerializingAttribute
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top