issue with xml serialization of a custom class

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
 
A

Adrian Forbes [ASP MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top