I am able to serialize a single type/class but is there a way that I can serialize it base class too?
For example:
class B:A
Here I am able to serialize class B but how can I serialize class A ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Amust know in advance, i.e.Now a
new XmlSerializer(typeof(A))can serialize anAor aB. You can also do this without attributes by passing in aextraTypesparameter to the overloadedXmlSerializerconstructor, but again – the root should beA; i.e.new XmlSeralializer(typeof(A), new[] {typeof(B)})