ArcGIS Pro 2.8 API Reference Guide
ReplaceNaNZs Method (IGeometryEngine)
Example 

ArcGIS.Core.Geometry Namespace > IGeometryEngine Interface : ReplaceNaNZs Method
The geometry to replace non simple Zs.
The z-value to assign.
Replaces each non-simple (NaN) z-value on the geometry with the specified z-value. All other simple (non-NaN) z-values are unchanged.
Syntax
Function ReplaceNaNZs( _
   ByVal geometry As Geometry, _
   ByVal zValue As Double _
) As Geometry

Parameters

geometry
The geometry to replace non simple Zs.
zValue
The z-value to assign.

Return Value

A geometry in which each coordinate has a simple (non-NaN) z-value.
Exceptions
ExceptionDescription
Geometry is null or empty.
The method is not implemented for GeometryBag.
This geometry is not Z-Aware.
Remarks
Use this function in conjunction with GeometryEngine.IsSimpleAsFeature prior to saving a geometry to a geodatabase.
Example
List<Coordinate3D> coordsZ = new List<Coordinate3D>()
{
  new Coordinate3D(1, 2, double.NaN),
  new Coordinate3D(4, 5, 3),
  new Coordinate3D(7, 8, double.NaN)
};

Polygon polygon = PolygonBuilder.CreatePolygon(coordsZ);
// polygon.HasZ = true

Polygon polygonZReplaced = GeometryEngine.Instance.ReplaceNaNZs(polygon, -1) as Polygon;

// polygonZReplaced.Points[0].Z = -1
// polygonZReplaced.Points[1].Z = 3
// polygonZReplaced.Points[2].Z = -1
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

IGeometryEngine Interface
IGeometryEngine Members