Get the segments of a Polyline
ICollection<Segment> collection = new List<Segment>();
polyline.GetAllSegments(ref collection);
int numSegments = collection.Count; // = 10
IList<Segment> iList = collection as IList<Segment>;
for (int i = 0; i < numSegments; i++)
{
// do something with iList[i]
}
// use the segments to build another polyline
Polyline polylineFromSegments = PolylineBuilderEx.CreatePolyline(collection);
Get the segments of a Polygon
List<Segment> segmentList = new List<Segment>(30);
ICollection<Segment> collection = segmentList;
polygon.GetAllSegments(ref collection);
// segmentList.Count = 4
// segmentList.Capacity = 30
// use the segments to build another polygon
Polygon polygonFromSegments = PolygonBuilderEx.CreatePolygon(collection);
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.