I am creating a command to allow user to select a bunch of objects on a plane.
My question is how do I loop through the list of objects as there are many types. At the start, I may just want to handle only Curve and TextEntity.
I use GetObject function to get any objects.
But what I find is do I use the GetType() and compare the type of Object.
Is there a smarter way of looping through the list of Geometry?
GetResult result = go.GetMultiple(1, -1);
for (int i = 0; i < go.ObjectCount; i++)
{
// Check the type of the Object and process differently
GeometryBase geo = go.Object(i).Geometry();
geoList.Add(geo);
}
foreach (GeometryBase g in geoList)
{
if(g.GetType().Equals(typeof(PolyCurve)))
{
System.Windows.Forms.MessageBox.Show("PolyCurve");
}
else if(g.GetType().Equals(typeof(Curve)))
{
System.Windows.Forms.MessageBox.Show("Curve");
}
else if(g.GetType().Equals(typeof(TextEntity)))
{
System.Windows.Forms.MessageBox.Show("TextEntity");
}
}