Gets the number of points in the single-part Polyline. If called on a multipart Polyline, counts the number of points in the first path only.

Namespace:  ESRI.ArcGISExplorer.Geometry

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public int PointCount()
Visual Basic (Declaration)
Public Function PointCount As Integer

Return Value

An integer indicating the number of points in Polyline, or in the first path the Polyline has multiple paths.

Remarks

Use this method to return the number of Points in the Polyline. Like other methods without a specific path index, this method applies to all polylines but if called on a multipart Polyline then the method only applies to the first path. This method is often used with other methods without a path index parameter; for example, a very common use is to use PointCount with GetPoint(Int32) to iterate through all the points in a single part Polyline.

Alternatives are the PointCount(Int32) overload which counts points in a specific path, or the PointCountAllPaths()()() method which counts the total number of points in all paths in the Polyline.

Examples

The code below shows how to use the GetPoint and PointCount methods to enumerate over each vertex in a single part Polyline by point index number. The code assumes there is an existing Polyline called poly. Instances of the Point class are fully-qualified to avoid namespace clashes with System.Drawing.Point.
CopyC#
// For an existing single part Polyline called pline, use PointCount to iterate points by index number.
for (int partIndx = 0; partIndx < pline.PathCount; partIndx++)
{
  for (int pointIndx = 0; pointIndx < pline.PointCount(); pointIndx++)
  {
    // Use GetPoint overload to get a copy of the specific point in the specific path.
    System.Diagnostics.Debug.WriteLine(pline.GetPoint(partIndx, pointIndx).ToString());
  }
}
CopyVB.NET
' For an existing single part Polyline called pline, use PointCount to iterate points by index number.
For partIndx As Integer = 0 To pline.PathCount - 1
    For pointIndx As Integer = 0 To pline.PointCount(partIndx) - 1
        ' Use GetPoint overload to get a copy of the specific point in the specific path.
        System.Diagnostics.Debug.WriteLine(pline.GetPoint(partIndx, pointIndx).ToString())
    Next pointIndx
Next partIndx

See Also