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

commented: thank you, you helped me with my question and now I understand foreach +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.