﻿PointCount Method        Gets the number of points in the single-part Polygon. If called on a multipart Polygon, counts the number of points in the first ring 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 Polygon, or in the first ring the Polygon has multiple rings.

# Remarks

Use this method to return the number of Points in the Polygon. Like other methods without a specific ring index, this method applies to all polygons but if called on a multipart Polygon then the method only applies to the first ring. This method is often used with other methods without a ring 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 Polygon.

Alternatives are the PointCount(Int32) overload which counts points in a specific ring, or the PointCountAllRings()()() method which counts the total number of points in all rings in the Polygon.

# Examples

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