Currently struggling with a issue. I have 30 objects in an array. data[], in each object there is 24 hours. "Hour00", "Hour01" and so on. I want to iterate through these hours. if(data[i].Hour00 > something) But it seems like I cant increment this in an easy way. I tried with the code below but it doesn't allow me to use the string "b" to define which of the hours I want to extract.
for(int k = 0; k < 24; k++)
{
string b = "Hour00";
if(data[i].b > 20){
*Something happens*
}
also tried:
for(int k = 0; k < 24; k++)
{
if(data[i].Hour(k) > 20){
*Something happens*
}
data? What is it an array of?Hour00,Hour01... and the value is an int. Then you can loop through that much more easily than iterating through all properties and dynamically adding the variable name.int,TimeSpanorDateTimeproperty instead of this string mess?