I'm new to C# and would like to ask for some direction on solving the following problem.
I've got a xml file used as a template (without knowing its content in advance). something like:
<Object>
<Property name="ID">
<Value weight="40">10000</Value>
<Value weight="60">20000</Value>
</Property>
<Property name="Name">
<Value weight="">foo</Value>
<Value weight="">bar</Value>
</Property>
<Property name="Department">
<SubProperty name="Department_ID">
<Value weight="20">D01</Value>
<Value weight="80">D02</Value>
</SubProperty>
<SubProperty name="Location">
<Value weight="30">F01</Value>
<Value weight="70">F02</Value>
</SubProperty>
</Property>
</Object>
I would like to read it in, do some shuffle, and export to a new xml file. Say, get the value of each property randomly, in accordance to their weights(percentage), to create a new list of mix-propertied objects, then serialize it to a new xml file.
Will this be done using Reflection.Emit to create a new "class" at runtime? Or is there any new features, like DynamicObject of C# 4.0 that I can use?
Any comment/sample is appreciated, thanks!