When I add an “XmlAttribute/XmlElement” to a property in an Interface and 100 other classes inherit from this interface, when Serializing the object to XML – why doesn’t the attributename I entered show up in the XML file after serialization?
interface Test
{
[XmlAttribute("Name")]
bool PropertyName { get; set; }
}
when saving the file, is shows “PropertyName” and not “Name”.
Is there any way to make it work, so a proeprty with an XmlAttributes added to an interface changes the Value everywhere instead of Value because if a few classes inherit from the same interface it takes alot of time to add all those Attributes to all those classes that inherit it, and it would be easier to change the Name of the Attribute instead of changing a 100 of them.
Deukalin, spent some time and make it work with comprehensive tree of classes and interfaces.
Here is the working code
Below is the output of sample above