c# serialize nested class

前端 未结 3 1580
无人及你
无人及你 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:51

    You can't serialize an interface..

    An interface is nothing more than a description of a set of behaviors. It says nothing about the contents of an instance. In particular, although an instance of a class implementing an interface must implement all of its members, it will certainly have properties of its own which need to be serialized.

    PS: copied from Serializing interfaces

提交回复
热议问题