public static XYExtent GetExtent(XYPolygon polygon) { XYExtent res = new XYExtent(); foreach (XYPoint point in polygon.Points) { res.Include(point.X, point.Y); } return(res); }