This is my class structure:
class DataItem
{
public string Id { get; set; }
public string Type { get; set; }
private Dictionary<string, DataProperty> properties = new Dictionary<string, DataProperty>();
public Dictionary<string, DataProperty> Properties
{
get { return properties; }
set { properties = value; }
}
}
public class DataProperty
{
public string Key { get; set; }
public string Value { get; set; }
public bool Required { get; set; }
}
This is XML I want to use (NOTE: I can change the xml if needed):
<Data>
<DataItem>
<id>ph15</id>
<type>core</type>
<properties>
<DataProperty>
<key>size</key>
<value>50%</value>
<required>false</required>
</DataProperty>
<DataProperty>
<key>color</key>
<value>red</value>
<required>true</required>
</DataProperty>
</properties>
</DataItem>
<DataItem>
<id>ph234</id>
<type>core</type>
<properties>
</properties>
</DataItem>
</Data>
Eventually XML should be loaded into another dictionary:
private Dictionary<string, DataItem> Mydata;