Here is my object
[Serializable()]
public class PersistentObject
{
public virtual int ID {
get { return id; }
protected set { id = value;}
}
...
}
When I try to serialize this to xml, I get an error "The Property or indexer PersistentObject.ID cannot be used in this context because the set accessor is inaccessible" . If the setter doesn't exist, it works fine. I want to keep this ID as serialized without a hacktastic solution that involves an of [XmlIgnore()] on ID. I would prefer if I could add [XmlIgnore()] on just the setter, but the compiler complains. Anybody have a good solution around this?