How do I display the results of list<t>. I put rangeChecker objects in range and now I want to display the rangeChecker objects in range. How whould I do that?

static void display(RangeChecker[] rangeChecker, int SIZE)
        {
            //displays values for x, y, z, and how many times z was below x and y
            int under = 0;
            List<RangeChecker> range = new List<RangeChecker>();
            range.Add(rangeChecker[0]);
            under = rangeChecker[0].getUnder();
            for (int i = 0; i < SIZE-1; i++)
            {
                
                if (under == rangeChecker[i + 1].getUnder())
                {
                    range.Add(rangeChecker[i+1]);
                }
                else if (under < rangeChecker[i + 1].getUnder())
                {
                    range.Clear();
                    under = rangeChecker[i + 1].getUnder();
                    range.Add(rangeChecker[i + 1]);
                }

            }
            for(int i=0; i<range.Count(); i++)
          
        }

In foreach loop:

List<RangeChecker> range = new List<RangeChecker>();
//then you fill the list!
for(int i = 1; i< 5; i++)
{
    RangeChecker rr = new RangeChecker();
    //i will insert some example data
    rr.Meter = i;
    rr.Yard = (i*0.9)
    range.Add(rr);
}

//read out of it:
foreach(RangeChecker rc in range)
{
    int intMeter = rc.meter;  //reading meter property
    int intYard = rc.yard;    //reading yard property
}

//lets say you have a class RangeChecker with properties:
class RangeChecker
{
    public int meter { get; set; }
    public int yard  { get; set; }
}

Hope it helps explaining how generic list with custom object works
Mitja

Comments
thank you, you helped me with my question and now I understand foreach
This question has already been answered. Start a new discussion instead.