I already have code working that iterate over class properties The thing is i want my class properties to be determined on the fly. I want to achieve something like that
MyClass
{
public double value1{ set; get; }
public double value2{ set; get; }
public double value3{ set; get; }
.....
}
Dictionary<int, MyClass> myDict;
/*this could be changed idk*/
PropertyInfo variableproperty= myClassesProperties;
foreach (PropertyInfo myClassesProperties in myDict.ElementAt(0).Value.GetType().GetProperties())
{
for (int i = 0; i < myDict.Count(); i++)
{
myDict.ElementAt(i).Value.variableproperty=.......
}
}
how to write a code to produce this something like that
Update: in the end I want to loop through the values that exist in MyClass manipulating one single specific property each time and get their data.