ArcGIS Pro 2.8 API Reference Guide
ToSegment() Method
Example 

ArcGIS.Core.Geometry Namespace > CubicBezierBuilder Class : ToSegment() Method
Returns a CubicBezierSegment instance representing the current state of the builder. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public CubicBezierSegment ToSegment()
Public Function ToSegment() As CubicBezierSegment

Return Value

A CubicBezier segment.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Example
// Use a builder convenience method or use a builder constructor.

MapPoint startPt = MapPointBuilder.CreateMapPoint(1.0, 1.0, SpatialReferences.WGS84);
MapPoint endPt = MapPointBuilder.CreateMapPoint(2.0, 2.0, SpatialReferences.WGS84);

MapPoint ctrl1Pt = MapPointBuilder.CreateMapPoint(1.0, 2.0, SpatialReferences.WGS84);
MapPoint ctrl2Pt = MapPointBuilder.CreateMapPoint(2.0, 1.0, SpatialReferences.WGS84);

List<MapPoint> listMapPoints = new List<MapPoint>();
listMapPoints.Add(startPt);
listMapPoints.Add(ctrl1Pt);
listMapPoints.Add(ctrl2Pt);
listMapPoints.Add(endPt);

// Builder convenience methods don't need to run on the MCT
CubicBezierSegment bezier = CubicBezierBuilder.CreateCubicBezierSegment(listMapPoints);

// Builder constructors need to run on the MCT
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
  using (CubicBezierBuilder cbb = new CubicBezierBuilder(listMapPoints))
  {
    // do something with the builder

    bezier = cbb.ToSegment();
  }
});

// builderEx constructors dont need to run on the MCT
CubicBezierBuilderEx cbbEx = new CubicBezierBuilderEx(listMapPoints);
bezier = cbbEx.ToSegment() as CubicBezierSegment;

// builderEx convenience methods dont need to run on the MCt
bezier = CubicBezierBuilderEx.CreateCubicBezierSegment(listMapPoints);
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

CubicBezierBuilder Class
CubicBezierBuilder Members