private int ReportInvalidPoints([NotNull] IPointCollection points, [NotNull] IRow row) { var points5 = points as IPointCollection5; if (points5 == null) { points5 = new MultipointClass(); points5.AddPointCollection(points); } int pointCount = points.PointCount; if (_sourcePoints == null || _sourcePoints.Length < points.PointCount) { const int margin = 2000; _sourcePoints = new WKSPointVA[pointCount + margin]; } points5.QueryWKSPointVA(0, pointCount, out _sourcePoints[0]); // This would be fast, but about 4* slower then the statement above //for (int i = 0; i < pointCount; i++) //{ // WKSPointVA wksPoint; // points5.QueryWKSPointVA(i, 1, out wksPoint); Dictionary <IssueCode, ErrorPoints> errorPointsDict = null; for (var i = 0; i < pointCount; i++) { WKSPointVA wksPoint = _sourcePoints[i]; string error; bool isNewRow = i == 0; IssueCode code; if (IsInvalidValue(wksPoint.m_m, row, isNewRow, out error, out code)) { if (errorPointsDict == null) { errorPointsDict = new Dictionary <IssueCode, ErrorPoints>(); } Assert.NotNull(code); ErrorPoints errorPoints; if (!errorPointsDict.TryGetValue(code, out errorPoints)) { errorPoints = new ErrorPoints(); errorPointsDict.Add(code, errorPoints); } errorPoints.Add(wksPoint, error); } } //ICollection<IPoint> errorPoints = MeasureUtils.GetPointsWithInvalidM( // points, _queryPoint, invalidValue); if (errorPointsDict == null) { return(NoError); } var errorCount = 0; foreach (KeyValuePair <IssueCode, ErrorPoints> pair in errorPointsDict) { IssueCode issueCode = pair.Key; ErrorPoints errorPoints = pair.Value; IPointCollection5 errorGeometry = new MultipointClass(); errorGeometry.AddWKSPointVA(errorPoints.Points.Count, ref errorPoints.Points.ToArray()[0]); ((IGeometry)errorGeometry).SpatialReference = ((IGeometry)points).SpatialReference; string errorDescription = GetErrorDescription(issueCode, errorPoints.Points.Count, errorPoints.Errors); errorCount += ReportError(errorDescription, (IGeometry)errorGeometry, issueCode, _shapeFieldName, row); } return(errorCount); }