ArcGIS Pro 2.8 API Reference Guide
ToGeometry Method (MultipointBuilderEx)
Example 

ArcGIS.Core.Geometry Namespace > MultipointBuilderEx Class : ToGeometry Method
Returns a Multipoint instance representing the current state of the builder.
Syntax
public override Geometry ToGeometry()
Public Overrides Function ToGeometry() As Geometry

Return Value

Example
// Use a builder convenience method or use a builder constructor.

List<MapPoint> list = new List<MapPoint>();
list.Add(MapPointBuilder.CreateMapPoint(1.0, 1.0));
list.Add(MapPointBuilder.CreateMapPoint(1.0, 2.0));
list.Add(MapPointBuilder.CreateMapPoint(2.0, 2.0));
list.Add(MapPointBuilder.CreateMapPoint(2.0, 1.0));

// Builder convenience methods don't need to run on the MCT.
Multipoint multiPoint = MultipointBuilder.CreateMultipoint(list);
int ptCount = multiPoint.PointCount;

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

    Multipoint mPt = mpb.ToGeometry();

    ptCount = mpb.PointCount;
  }
});

// or use the builderEx constructors - don't need to run on the MCT.
MultipointBuilderEx builderEx = new MultipointBuilderEx(list);
multiPoint = builderEx.ToGeometry() as Multipoint;
ptCount = builderEx.PointCount;


// builderEx convenience methods dont need to run on the MCT
//  use AttributeFlags.NoAttributes - we have 2d points in the list
multiPoint = MultipointBuilderEx.CreateMultipoint(list, AttributeFlags.NoAttributes);
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

MultipointBuilderEx Class
MultipointBuilderEx Members