As you can see in blow code I want to deserialize custom xml to object, and I don't know how many code attribute there, so I want to filter all attribute that contains the "code", and map it with List property. Is there any way to implement this feature?
<Root>
<FirstElement FirstCode="1" SecondCode="2" ThirdCode="3" Id="1" Name="Element" />
</Root>
public class MappedClass
{
[XmlAttribute(AttributeName = "Name")]
public string Name {get;set;}
[XmlAttribute(AttributeName = "Id")]
public int Id {get;set;}
[?]
public List<Code> Codes {get;set;}
}
public Class Code
{
public string Name {get;set;}
public string Value {get;set;}
}
No comments:
Post a Comment