下面是要从xml反序列化到对象的代码。该列表不进行序列化并获得0个对象的计数。狗对象我也不会为空。从response.Content.ReadAsAsync<T>().Result;
[DataContract(Namespace = "", Name = "CarPark")]
public class Parent
{
[DataMember]
public List<Child> child{ get; set; }
[DataMember]
public string dog{ get; set; }
}
<Parent>
<Car><\Car>
<Car><\Car>
<Dog><\Dog>
</Parent>