views:

34

answers:

1

Hi there,

I want to make a class serializable but i dont want make serializable some fileds in this class. how can do that?

Thanks for your helps.

+1  A: 

If you are using BinaryFormatter to perform the serialization you might add the [NonSerialized] attribute to the field you wish to exclude.

For XmlSerializer look at the [XmlIgnore] attribute.

For DataContractSerializer look at the [IgnoreDataMember] attribute.

Darin Dimitrov