.net XmlSerializer, ignore base class properties

前端 未结 4 1802
轮回少年
轮回少年 2021-01-20 08:18

Lets say we have a derivided class \"SerializableLabel\" from the base class \"System.Windows.Controls.

[XmlRoot(\"SerializableLabel\")]
public class Seriali         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-20 09:08

    You could write a custom serializer with IXmlSerializable, but you would create a situation where your serialization does not reconstitute the class properly. Let's say someone the BackColor on your SerializableLabel, that would not come through the serialization process properly.

提交回复
热议问题