Hi
Point3d[] PntLst = new Point3d[pts.Count];
pts.CopyTo(PnLst, 0);
Not bad. Interestingly, it's not clearcut that this is always the fastest way. Good old one-by-one ranks in the top too.
Foo fooArray = new Foo[fooCollection.Count];
for(int i=0;i<foo.Count;i++) fooArray[i]=fooCollection[i];
And if an untyped array were sufficient, construction via ArrayList could steal the show.
object[] objArray = (new System.Collections.ArrayList(fooCollection)).ToArray();
From cursory timing it would appear that System.Collections.ICollection.CopyTo performs best with bigger data.
Thanks kaefer.
In another part of my program, I was collecting points of subentities of a polyline,
so during the loop I used List<Point3d> lst.AddRange to collect all the points before adding them to
the final array. PntLst = lst.ToArray();
This worked with the GetSamplePoints() method.
Don't know why some methods return a Point3d[] and some a Point3dCollection(), if it even matters
but List<> is another way to handle points so I thought I'd mention it.