issue with xml serialization of a custom class

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

I am trying to serialize a class that implements ienumerable. it has a
private arraylist that contains instances of a custom class.

At this point the xml resembles:
<PropertyInfos><anyType xsi:type="PropertyInfo"></anyType></PropertyInfos>"

I would like the xml to resemble:
<PropertyInfos><PropertyInfo></PropertyInfo></PropertyInfos>

I've tried marking the PropertyInfo class with <xmlelement> and
<xslarrayitem>, but both generate an error that reads: attribute ... can
not be applied to ... because the attribute is not valid on this declaration
type.

What is the correct way to mark the ProperyInfo class to have the xml
generated in the way I desire? Also, is there a way to get the xml to
include readonly properties?

Thanks,

Craig Buchanan
 
Classic question, I guess, but why are you implementing ienumerable? If you
base your class on an existing collection type it might make things easier
for you.
 
Back
Top