XmlIgnore an inherited attribute

  • Thread starter Thread starter bg_ie
  • Start date Start date
B

bg_ie

Hi,

I have a number of classes that inherit from another class which
contains an attribure called "Url". I serialise my objects to an xml
file, but I would like to hide the "url" attribute for one of my
inherited classes. I can place the XmlIgnore in the base class, but
this will hide the attribute for all derived class. What should I do?

Thanks,

Barry.
 
You could try adding a "bool ShouldSerializeUrl()" method; this is a
pattern (like "event EventHandler UrlChanged") recognised by various
parts of the core framework.

If you have inheritance, though, you may need to do this at the base
class (return true), and then override in the subclass (return false).

Marc
 
You could try adding a "bool ShouldSerializeUrl()" method; this is a
pattern (like "event EventHandler UrlChanged") recognised by various
parts of the core framework.

If you have inheritance, though, you may need to do this at the base
class (return true), and then override in the subclass (return false).

Marc
 
Back
Top