Is it more sensible to use .DuplicateSegments() or

convert PolylineCurve into PolyCurve and use PolyCurve.SegmentCount to get the number of segments?

How do I convert PolylineCurve to PolyCurve anyway?

What are you trying to do? Do you want to get the number of segments in a PolyLineCurve?

PolyLineCurve plc; // defined elsewhere
int numberOfSegments = plc.IsClosed ? plc.PointCount : plc.PointCount - 1;

I want to iterate thru the PolyCurve segments using segment index (in case I need to modify segments or what not), but I have no clue how to convert PolylineCurve into PolyCurve, and PolylineCurve doesn’t have .SegmentCount method. Exploding Polyline to get segment count seems like a dumb idea also.

For now I can work around it by using .DuplicateSegments() and .Replace() if I need to. But I just wanna learn how to do it the above mentioned way.

I guess something like this could work:

PolylineCurve plc; 
for (int i = 1; i < plc.PointCount; ++i)
{
 Line segment = new Line(plc.Point(i-1), plc.Point(i));
 if (needsToChange) {
   plc.SetPoint(i-1, segment.From);
   plc.SetPoint(i, segment.To);
 }
}

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_PolylineCurve_Point.htm
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_PolylineCurve_SetPoint.htm