We wanted to add some padding to the Extents to the Collection of Graphics
We send the Collection and % to pad.
Was interested in knowing if this is the correct way of doing it. Does this always work in any coordinate system.
       public static Envelope GetExtentsForGraphicCollection(GraphicCollection gc, double percentToPadEnvelope)
        {
            double? minX = null;
            double? minY = null;
            double? maxX = null;
            double? maxY = null;
            foreach (Graphic g in gc)
            {
                double tempMinX = Convert.ToDouble(g.Attributes["MIN_X"]);
                double tempMinY = Convert.ToDouble(g.Attributes["MIN_Y"]);
                double tempMaxX = Convert.ToDouble(g.Attributes["MAX_X"]);
                double tempMaxY = Convert.ToDouble(g.Attributes["MAX_Y"]);
                if (minX == null || tempMinX < minX)
                    minX = tempMinX;
                if (minY == null || tempMinY < minY)
                    minY = tempMinY;
                if (maxX == null || tempMaxX > maxX)
                    maxX = tempMaxX;
                if (maxY == null || tempMaxY > maxY)
                    maxY = tempMaxY;
            }
            double xPadding = (double)(maxX - minX) * percentToPadEnvelope;
            double yPadding = (double)(maxY - minY) * percentToPadEnvelope;
            minX = minX - xPadding;
            maxX = maxX + xPadding;
            minY = minY - yPadding;
            maxY = maxY + yPadding;
            return new Envelope((double)minX, (double)minY, (double)maxX, (double)maxY);
        }