c# inheriting generic collection and serialization

前端 未结 5 2117
礼貌的吻别
礼貌的吻别 2020-12-06 13:36

The setup:

class Item
{
    private int _value;

    public Item()
    {
        _value = 0;
    }

    public int Value { get { return _value; } set { _valu         


        
5条回答
  •  春和景丽
    2020-12-06 13:49

    XmlSerializer is evil. That said, any object that implements IEnumerable will be serialized as an simple collection, ignoring any extra properties you've added yourself.

    You will need to create a new class that holds both your property and a property that returns the collection.

提交回复
热议问题