ArcGIS Pro 2.8 API Reference Guide
HasID Property (GeometryBuilder<T>)
Example 

ArcGIS.Core.Geometry Namespace > GeometryBuilder<T> Class : HasID Property
Gets or sets the HasID flag of the instance.
Syntax
public virtual bool HasID {get; set;}
Public Overridable Property HasID As Boolean
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
The method is not implemented for empty GeometryBagBuilder
Remarks
Attribute awareness (HasZ, HasM, HasID) can be implicitly set rather than explicitly set in the following scenarios

1. When creating a geometry using a convenience method on the builder and a value for the attribute or an object with attribute awareness is passed as a parameter.

2. When creating a geometry from the builder ToGeometry method and a geometry of the same type with attribute awareness was passed to the builder constructor.

3. When creating a MapPoint from MapPointBuilder.ToGeometry and a value for the attribute was passed to the builder constructor.

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

MapPoint point1 = null;
MapPoint point2 = 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))
  {
    bool bhasZ = mb.HasZ;          // hasZ = true
    bool bhasM = mb.HasM;          // hasM = false
    bool bhasID = mb.HasID;        // hasID = false

    // do something with the builder

    point1 = mb.ToGeometry();

    // change some of the builder properties
    mb.X = 11;
    mb.Y = 22;
    mb.HasZ = false;
    mb.HasM = true;
    mb.M = 44;
    // create another point
    point2 = mb.ToGeometry();
  }
});

double x = point1.X;                  // x = 1.0
double y = point1.Y;                  // y = 2.0
double z = point1.Z;                  // z = 3.0
double m = point1.M;                  // m = Nan
int ID = point1.ID;                   // ID = 0
bool hasZ = point1.HasZ;              // hasZ = true
bool hasM = point1.HasM;              // hasM = false
bool hasID = point1.HasID;            // hasID = false
bool isEmpty = point1.IsEmpty;        // isEmpty = false

bool isEqual = point1.IsEqual(point2);    // isEqual = false

// Builder convenience methods don't need to run on the MCT.
MapPoint point3 = MapPointBuilder.CreateMapPoint(point1);
x = point3.X;                   // x = 1.0
y = point3.Y;                   // y = 2.0
z = point3.Z;                   // z = 3.0
m = point3.M;                   // m = Nan
ID = point3.ID;                 // ID = 0
hasZ = point3.HasZ;             // hasZ = true
hasM = point3.HasM;             // hasM = false
hasID = point3.HasID;           // hasID = false


// builderEx constructors don't need to run on the MCT.
MapPointBuilderEx builderEx = new MapPointBuilderEx(point1);
x = builderEx.X;              // x = 1.0
y = builderEx.Y;              // y = 2.0
z = builderEx.Z;              // z = 3.0
m = builderEx.M;              // m = Nan
ID = builderEx.ID;            // ID = 0
hasZ = builderEx.HasZ;        // hasZ = true
hasM = builderEx.HasM;        // hasM = false
hasID = builderEx.HasID;      // hasID = false
isEmpty = builderEx.IsEmpty;     // isEmpty = false

MapPoint point4 = builderEx.ToGeometry() as MapPoint;


// builderEx convenience methods don't need to run on the MCT.
MapPoint point5 =MapPointBuilderEx.CreateMapPoint(point1);
x = point5.X;              // x = 1.0
y = point5.Y;              // y = 2.0
z = point5.Z;              // z = 3.0
m = point5.M;              // m = Nan
ID = point5.ID;            // ID = 0
hasZ = point5.HasZ;        // hasZ = true
hasM = point5.HasM;        // hasM = false
hasID = point5.HasID;      // hasID = false
isEmpty = point5.IsEmpty;     // isEmpty = false
// list of points
List<MapPoint> points = new List<MapPoint>
{
  MapPointBuilder.CreateMapPoint(0, 0, 2, 3, 1),
  MapPointBuilder.CreateMapPoint(1, 1, 5, 6),
  MapPointBuilder.CreateMapPoint(2, 1, 6),
  MapPointBuilder.CreateMapPoint(0, 0)
};

// will have attributes because it is created with convenience method
Polyline polylineWithAttrs = PolylineBuilder.CreatePolyline(points);

bool hasZ = polylineWithAttrs.HasZ;          // hasZ = true
bool hasM = polylineWithAttrs.HasM;          // hasM = true
bool hasID = polylineWithAttrs.HasID;        // hasID = true

// will have attributes because it is created with convenience method
Polygon polygonWithAttrs = PolygonBuilder.CreatePolygon(points);
hasZ = polygonWithAttrs.HasZ;               // hasZ = true
hasM = polygonWithAttrs.HasM;               // hasM = true
hasID = polygonWithAttrs.HasID;             // hasID = true

// Builder constructors need to run on the MCT.
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
  // will not have attributes because it is passed something other than an attributed polyline
  using (PolylineBuilder polylineB = new PolylineBuilder(points))
  {
    hasZ = polylineB.HasZ;                      // hasZ = false
    hasM = polylineB.HasM;                      // hasM = false
    hasID = polylineB.HasID;                    // hasID = false
  }

  // will have attributes because it is passed an attributed polyline
  using (PolylineBuilder polylineB = new PolylineBuilder(polylineWithAttrs))
  {
    hasZ = polylineB.HasZ;                      // hasZ = true
    hasM = polylineB.HasM;                      // hasM = true
    hasID = polylineB.HasID;                    // hasID = true
  }

  // will not have attributes because it is passed something other than an attributed polygon
  using (PolygonBuilder polygonB = new PolygonBuilder(points))
  {
    hasZ = polygonB.HasZ;                       // hasZ = false
    hasM = polygonB.HasM;                       // hasM = false
    hasID = polygonB.HasID;                     // hasID = false
  }

  // will have attributes because it is passed an attributed polygon
  using (PolygonBuilder polygonB = new PolygonBuilder(polygonWithAttrs))
  {
    hasZ = polygonB.HasZ;                       // hasZ = true
    hasM = polygonB.HasM;                       // hasM = true
    hasID = polygonB.HasID;                     // hasID = true
  }
});
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

GeometryBuilder<T> Class
GeometryBuilder<T> Members