I have an existing List<MyObject>
containing 15 MyObject(s). I want to read an XML document and map the XML document to this data.
The MyObject class has 3 public properties;
+id :int
+value1 :float
+value2 :float
The XML document has this structure;
<root>
<objects>
<object id="1">
<value1>S</value1>
<value2>B</value2>
</object>
<object id="2">
<value1>A</value1>
<value2>J</value2>
</object>
</objects>
</root>
Although the original List<MyObject>
has 15 items, the incoming XML document only has 2 items, I need to maps the XML objects by id and change the List values.
so the data for XML document
object id=1, value1 = s, value2= b
object id=2, value1 = a, value2= j
and the data for the List<MyObject>
items are
object id=1 value1= a, value2 = b
object id=2 value1= c, value2 = d
object id=3 value1= k, value2 = z
object id=4 value1= y, value2 = e
I need to read the XML document and merge it with the existing List<MyObject>
the result of the list should look like;
object id=1 value1= s, value2 = b
object id=2 value1= a, value2 = j
object id=3 value1= k, value2 = z
object id=4 value1= y, value2 = e