ArcGIS Pro 2.9 API Reference Guide
Parts Property (Multipart)
Example 

ArcGIS.Core.Geometry Namespace > Multipart Class : Parts Property
Gets the parts in the geometry.
Syntax
public virtual ReadOnlyPartCollection Parts {get;}
Public Overridable ReadOnly Property Parts As ReadOnlyPartCollection
Example
int numParts = polyline.PartCount;
// get the parts as a readonly collection
ReadOnlyPartCollection parts = polyline.Parts;
ReadOnlyPartCollection polylineParts = polyline.Parts;

// enumerate the segments to get the length
double len = 0;
IEnumerator<ReadOnlySegmentCollection> segments = polylineParts.GetEnumerator();
while (segments.MoveNext())
{
  ReadOnlySegmentCollection seg = segments.Current;
  foreach (Segment s in seg)
  {
    len += s.Length;

    // perhaps do something specific per segment type
    switch (s.SegmentType)
    {
      case SegmentType.Line:
        break;
      case SegmentType.Bezier:
        break;
      case SegmentType.EllipticArc:
        break;
    }
  }
}

// or use foreach pattern
foreach (var part in polyline.Parts)
{
  foreach (var segment in part)
  {
    len += segment.Length;

    // perhaps do something specific per segment type
    switch (segment.SegmentType)
    {
      case SegmentType.Line:
        break;
      case SegmentType.Bezier:
        break;
      case SegmentType.EllipticArc:
        break;
    }
  }
}
// get the parts as a readonly collection
ReadOnlyPartCollection parts = polygon.Parts;
int numSegments = 0;
IEnumerator<ReadOnlySegmentCollection> segments = polygon.Parts.GetEnumerator();
while (segments.MoveNext())
{
  ReadOnlySegmentCollection seg = segments.Current;
  numSegments += seg.Count;
  foreach (Segment s in seg)
  {
    // do something with the segment
  }
}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

Multipart Class
Multipart Members