Questions tagged «xmlserializer»

5
使用XmlInclude或SoapInclude属性可以指定静态未知的类型
使用.NET时,我遇到了一个非常奇怪的问题XmlSerializer。 采取以下示例类: public class Order { public PaymentCollection Payments { get; set; } //everything else is serializable (including other collections of non-abstract types) } public class PaymentCollection : Collection<Payment> { } public abstract class Payment { //abstract methods } public class BankPayment : Payment { //method implementations } AFAIK,有三种不同的方法来解决InvalidOperationException由序列化器不了解的派生类型引起的Payment。 1.添加XmlInclude到Payment类定义中: …
96 c#  .net  xml  xmlserializer 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.