Hello, i have a problem.
int index2 = 1;
foreach(Circle circle in arrays)
{
if(index2 > 1 && index2 < 6)
{
Circle c1 = (Circle) arrays[index2 - 1];
Circle c2 = (Circle) arrays[index2 - 2];
Console.WriteLine("Radien på cirkel {0} är {1} och arean är {2}", index2, circle.getRadius(), circle.getArea());
//This is written out first and then the line if the circles have same messures or not.
if(c1.Equals(c2))
{
Console.WriteLine("Cirkel {0} och {1} är lika stora.", index2 - 1, index2); // same messurements
}
else
Console.WriteLine("Cirkel {0} och {1} har olika mått.", index2 - 1, index2); // different messurements
}
There are five objects in the array list. I want to compare objeck 2 with 1, 3 with 2 and so on.
In this for-loop the statement
if(c1.Equals(c2))
never comes true.
anyone knows why, then im very happy.