JL.
JL.

Reputation: 81262

Ignoring a property during deserialization

I have a class that is serializing very nicely - finally!

Now I want to add a property to this class, that I don't want to be serialized at all.

Is it possible to add this new property with some kind of attribute so that when I call serialize or deserialize methods, this property will go unnoticed?

Upvotes: 6

Views: 6528

Answers (2)

bruno conde
bruno conde

Reputation: 48265

I think your looking for [XmlIgnore] attribute

Upvotes: 2

codeape
codeape

Reputation: 100766

[XmlIgnore]
public int DoNotSerialize { get { ... } set { ... } }

Upvotes: 16

Related Questions