I have two classes as such:
public class MachineLine
{
public double X1;
public double Y1;
public double X2;
public double Y2;
public double Thickness;
}
public class MachineCircle
{
public double CenterX;
public double CenterY;
public double Radius;
}
I want to make a List which can hold both of these, but I don’t want my list to be able to hold any other data type. How can this be done?
The easiest way to do this is to declare an interface, and have both types implement it:
Then you can do this: