ArcGIS Pro 2.7 API Reference Guide
CreateMapPoint(MapPoint,SpatialReference) Method
Example 

ArcGIS.Core.Geometry Namespace > MapPointBuilder Class > CreateMapPoint Method : CreateMapPoint(MapPoint,SpatialReference) Method
Specifies the coordinates for the MapPoint.
(Optional) The SpatialReference. The default value is null.
Convenience method to quickly create a MapPoint instance.
Syntax
public static MapPoint CreateMapPoint( 
   MapPoint point,
   SpatialReference spatialReference
)
Public Overloads Shared Function CreateMapPoint( _
   ByVal point As MapPoint, _
   Optional ByVal spatialReference As SpatialReference _
) As MapPoint

Parameters

point
Specifies the coordinates for the MapPoint.
spatialReference
(Optional) The SpatialReference. The default value is null.

Return Value

Exceptions
ExceptionDescription
Incompatible spatial references.
point is null.
Example
// Use a builder convenience method or use a builder constructor.

// Builder convenience methods don't need to run on the MCT.
// create a 3d point with M
MapPoint pt = MapPointBuilder.CreateMapPoint(1.0, 2.0, 3.0, 4.0);

MapPoint ptWithM = null;

// Builder constructors need to run on the MCT.
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
  using (MapPointBuilder mb = new MapPointBuilder(1.0, 2.0, 3.0, 4.0))
  {
    // do something with the builder

    ptWithM = mb.ToGeometry();
  }
});

MapPoint clone = ptWithM.Clone() as MapPoint;
MapPoint anotherM = MapPointBuilder.CreateMapPoint(ptWithM);


// builderEx constructors don't need to run on the MCT.
MapPointBuilderEx builderEx = new MapPointBuilderEx(1.0, 2.0, 3.0);
builderEx.HasM = true;
builderEx.M = 4.0;

pt = builderEx.ToGeometry() as MapPoint;


// or another alternative with builderEx constructor
builderEx = new MapPointBuilderEx(1.0, 2.0, true, 3.0, true, 4.0, false, 0);
pt = builderEx.ToGeometry() as MapPoint;
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

MapPointBuilder Class
MapPointBuilder Members
Overload List