XmlAnyAttribute when using XmlSerializer C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nelsonbrodyk
    New Member
    • Mar 2008
    • 81

    XmlAnyAttribute when using XmlSerializer C#

    Hey All,
    I have set up some code to handle the serialization/deserialization of objects to xml. The challenge I have is that for the xml, I want to be able to add new attributes at any point programatically , that would fall under the "any" attribute.


    My question is how is this done in C#? For what I've seen, you can use the [XmlAnyAttribute] attribute, but, this is applied to a property such as:

    public XmlAttribute[] AnyAttrs {
    get;
    set;
    }

    What I want to do is to actually be able to add a new XmlAttribute to this item. Is this possible? ie. We add a new field on the screen, called "Person's Hair Color". I would love to go myObj.AddAnyAtt r("HairColor" , "green"), and when we serialize, that attribute is now added.

    Thanks
  • nelsonbrodyk
    New Member
    • Mar 2008
    • 81

    #2
    Anyone have any ideas?

    Comment

    Working...