Setting
NPOINT
to
2
doesn't allocate the array to store the points.
So when you do this;
Myline[0].NPOINT = 2;
the backing field
pnt
of
data_line
is not changed to cater for storing
2
items.
Change
public int NPOINT{ get{return Npoint;} set{ Npoint = value; } }
to
public int NPOINT{ get{return Npoint;} set { Npoint = value; pnt = new point[value]; } }
(Note that I've left out any error handling and resizing or the points list from this).
On a side note, I would try using a
List
of
point
s instead of an array, it'll be easier to add/remove items then I think.
Hope this helps,
Fredrik