开发者

XmlSerialization and List

开发者 https://www.devze.com 2022-12-14 04:59 出处:网络
I have the following c开发者_如何学编程lass public class Notifications : List<Notification> { }

I have the following c开发者_如何学编程lass

public class Notifications : List<Notification> { }

Unfortunately, when it's serialized it looks like

<ArrayOfNotification>
  <Notification>
  ...

How can I get that root node to be Notifications? I've tried a few different attributes on the class, but none compile.


Try

using System.Xml.Serialization;
...
[XmlType(TypeName="Notifications")]
public class Notifications ...
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号