IXmlSerializable and inheritance

前端 未结 2 519
死守一世寂寞
死守一世寂寞 2021-01-13 21:21

Let\'s say that I have two classes, a base class and a derived class. They are fairly simple classes, and mainly just act as data structures (with the derived class obviousl

2条回答
  •  生来不讨喜
    2021-01-13 21:37

    XmlSerialization is not polymorphic (the member attributes, however, go with the declaring class; i.e. unless you overrule a member with the new keyword (in contrast to override) you'll 'inherit' the serialization attributes.

    Deserialization always results in the actual type that was serialized. This makes a lot of sense, really.

提交回复
热议问题