When I inherit from a class and serialize the new class I get all all properties. How can I prevent that? I have no control over the class that I inherit from. So I can\'t add
If B
inherits from A
, it inherits PropertyA
, and there's nothing you can do about it. If you don't want to serialize PropertyA
when serializing an instance of B
, perhaps you shouldn't be inheriting A
in the first place...
Anyway, I don't think XML serialization can help you with what you're trying to do, unless you implement IXmlSerializable
yourself...