ArcGIS Pro 2.9 API Reference Guide
MultipointBuilderEx Constructor(IEnumerable<MapPoint>,SpatialReference)
Example 

ArcGIS.Core.Geometry Namespace > MultipointBuilderEx Class > MultipointBuilderEx Constructor : MultipointBuilderEx Constructor(IEnumerable<MapPoint>,SpatialReference)
The enumeration of points which will initialize the builder. It cannot be null.
(Optional) The spatial reference. The default value is null.
Initializes a new instance of the MultipointBuilderEx class.
Syntax

Parameters

mapPoints
The enumeration of points which will initialize the builder. It cannot be null.
spatialReference
(Optional) The spatial reference. The default value is null.
Exceptions
ExceptionDescription
The input mapPoints enumeration is null.
Remarks
The spatial references of the points in the enumeration are ignored. There is not a check to see if all the spatial references are equal. If a point in the enumeration has coordinates that are outside the domain of the spatial reference, then unexpected results will occur when using the geometry.

The attributes of the input points are ignored.

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 11, Windows 10, Windows 8.1

See Also

Reference

MultipointBuilderEx Class
MultipointBuilderEx Members
Overload List