K
klem s
hi
1) Since B doesn’t contain any members of type E, when XmlSerializer
serializes object of type B to an xml file, it doesn’t create
subelement describing type E. It also doesn’t create subelement for
type A, from which B instance derives.
Any particular reason why it would be a bad idea for xmlFormat to also
create subelements for types E and A?
XmlSerializer xmlFormat = new XmlSerializer ( typeof( B ),
new Type[] { typeof( A ), typeof( D ),
typeof( E ) } );
class A{}
class B:A { D d = new D(): }
class D{}
class E{}
2)
a) Is there a particular reason why XmlSerializer only persists public
fields, but not private fields?
b) Why can’t XmlSerializer serialize types that don’t implement the
default constructor?
c) Why doesn’t XmlSerializer require classes to be marked with
serialized attribute.
thank you
1) Since B doesn’t contain any members of type E, when XmlSerializer
serializes object of type B to an xml file, it doesn’t create
subelement describing type E. It also doesn’t create subelement for
type A, from which B instance derives.
Any particular reason why it would be a bad idea for xmlFormat to also
create subelements for types E and A?
XmlSerializer xmlFormat = new XmlSerializer ( typeof( B ),
new Type[] { typeof( A ), typeof( D ),
typeof( E ) } );
class A{}
class B:A { D d = new D(): }
class D{}
class E{}
2)
a) Is there a particular reason why XmlSerializer only persists public
fields, but not private fields?
b) Why can’t XmlSerializer serialize types that don’t implement the
default constructor?
c) Why doesn’t XmlSerializer require classes to be marked with
serialized attribute.
thank you