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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -