我有一些从一个看起来像这样的服务中获得的 xml
<Pools>
<Pool Code="WN" Name="Win" />
<Pool Code="PL" Name="Place" />
<Pool Code="SH" Name="Show" />
<Pool Code="EX" Name="Exacta" />
<Pool Code="PE" Name="Perfecta (Exacta)" />
</Pools>
我想将其反序列化为以下类
public class Pools : List<Pool>
{
public Pools() { }
public Pools(int capacity) : base(capacity){ }
}
public class Pool
{
[XmlAttribute("Code")]
public string Code { get; set; }
[XmlAttribute("Name")]
public string Name { get; set; }
public Pool() {}
public Pool(string code, string name)
{
Code = code;
Name = name;
}
}
但它一直在失败,我不确定我做错了什么......我觉得这是 Pools 类的问题,但我不确定应用什么来使它工作
谢谢