I want to do something like this:
for (var i =0; i < obj.ValueList.Count; i++)
{
var runCode = $"oldObj.Mod{i+1} = obj.ValueList[{i}].Value;";
// Execute runCode; then 'oldObj.Mod1 = obj.ValueList[0].Value'
}
...
I just think it will ultimately be better than 5 or 10 or 100 explicit repetitions of oldObj.Mod1 = obj.ValueList[0].Value.
It has to have been done before.
Thoughts? Help? Direction?
I can't be sure if you really have to use for loop, but you can actually try to get the properties with reflection and then set values (see: https://stackoverflow.com/a/30475988/9709828) or you can also try to play with LINQ for getting necessarily list of oldObj's properties and set values through the for loop