c# - How to XML serialize child class with its base class -
i able serialize single type/class there way can serialize base class too?
for example:
class b:a
here able serialize class b how can serialize class ?
a
must know in advance, i.e.
[xmlinclude(typeof(b))] public class {...} public class b {...}
now new xmlserializer(typeof(a))
can serialize a
or b
. can without attributes passing in extratypes
parameter overloaded xmlserializer
constructor, again - root should a
; i.e. new xmlseralializer(typeof(a), new[] {typeof(b)})
Comments
Post a Comment