ArcGIS Pro 3.0 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 void GetAllSegments( 
       ref ICollection<Segment> segments
    )
    Public Sub GetAllSegments( _
       ByRef segments As ICollection(Of Segment) _
    ) 

    Parameters

    segments
    The collection of segments. If segments is null, a list will be allocated.
    Example
    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);
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also