XmlSerializer serialize generic List of interface

后端 未结 5 1402
别跟我提以往
别跟我提以往 2020-11-28 12:02

I\'m trying to use the XmlSerializer to persist a List(T) where T is an interface. The serializer does not like interfaces. I\'m curious if there is a simple way to serializ

5条回答
  •  清酒与你
    2020-11-28 13:03

    The easy way is to add the [Serializable()] decoration to your classes and change your IList to List and see if that works.

    If you use interfaces then go see webturner's answer.

提交回复
热议问题