c# serialize nested class

前端 未结 3 1577
无人及你
无人及你 2021-01-16 09:19

I\'m trying to serialize a dummy collection of orders, where each order contains a product. The collection is serializing fine, but the example product properties inside the

3条回答
  •  死守一世寂寞
    2021-01-16 09:49

    You have to change ICollection to List. An interface isn't serializeable.

    [XmlArray("Products")]
    public List Products
    {
        get
        {
            return this._products;
        }
    
    }
    

    And ProductTest doesn't work because of the missing setter

提交回复
热议问题