2
我有幾個WCF數據契約如下:差異與[XmlInclude]
[DataContract]
public class Hatchback: Car
{
[DataMember]
public int Wheels;
}
[KnownType(Hatchback)]
[DataContract]
public abstract class Car
{
}
我也可以寫爲:
[DataContract]
public class Hatchback: Car
{
[DataMember]
public int Wheels;
}
[XmlInclude(Hatchback)]
[DataContract]
public abstract class Car
{
}
之間有什麼差異性這兩種不同類型的實現? KnownType的XmlInclude有什麼優點/缺點嗎?