hi guys there are something i’m a bit confused
int count = doc.Objects.Count;
List<Guid> ids = new List<Guid>();
//when i add some obj Everything is correct
//1. doc.Objects.Count will increase
//2. doc.Objects.ToList() is right
for (int i=0;i<10;i++)
{
Point3d pt1 = new Point3d(10,i*5,0);
Point3d pt2 = new Point3d(20, i * 5, 0);
Guid id = doc.Objects.AddLine(pt1, pt2);
ids.Add(id);
}
doc.Views.Redraw();
//when i delete some obj there is some things wrong
//1. doc.Objects.Count still 10
//2. doc.Objects.ToList()
for (int i = 0; i < ids.Count-5; i++)
{
Point3d pt1 = new Point3d(10, i * 5, 0);
Point3d pt2 = new Point3d(20, i * 5, 0);
doc.Objects.Delete(ids[i],false);
}
//But this it's correct when ergodic doc.Objects
foreach (var item in doc.Objects)
{
if (item == null)
{
}
}
doc.Views.Redraw();
could you please explain to me what happend.and what are the issues with my usage .