Hi,
This is a two part question:
1)trying to serialize a read only class member. I have a
public property with a get statement, but not set, hence
read only. When I serialize the class, this property is
omitted. Can I serialze a public read-only member?
Code segment:
public class Page
{
private static int _number = 0;
[XmlAttribute("number")]
public int Number
{
get
{
return _number;
}
}
}
2)How do I change the element name of a class?
I tried [XMLAttribute("Part")
public class SectionPart
{
}
but the compiler complained stating I couldn't do this.
I wan't the serialization to change the <SectionPart>
element to <Part>
How is this done?
Thanks a lot