ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / Multipart Class / GetAllSegments Method
The collection of segments. If segments is null, a list will be allocated.
Example

In This Topic
    GetAllSegments Method
    In This Topic
    Gets all the segments in this instance.
    Syntax
    Public Sub GetAllSegments( _
       ByRef segments As ICollection(Of Segment) _
    ) 
    public void GetAllSegments( 
       ref ICollection<Segment> segments
    )

    Parameters

    segments
    The collection of segments. If segments is null, a list will be allocated.
    Example
    Get the segments of a Polyline
    {
      ICollection<Segment> collectionSegments = new List<Segment>();
      polyline.GetAllSegments(ref collectionSegments);
      int numSegmentsInCollection = collectionSegments.Count;    // = 10
    
      IList<Segment> iList = collectionSegments as IList<Segment>;
      for (int i = 0; i < numSegmentsInCollection; i++)
      {
        // do something with iList[i]
      }
    
      // use the segments to build another polyline
      Polyline polylineFromSegments = PolylineBuilderEx.CreatePolyline(collectionSegments);
    }
    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);
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also