Exemplo n.º 1
0
        public Rectangle(double height, double width)
        {
            SimpleValidator.CheckNotPositive((decimal)height, "height");
            SimpleValidator.CheckNotPositive((decimal)width, "width");

            this.Height = height;
            this.Width  = width;
        }
Exemplo n.º 2
0
        public Square(double height, double width)
        {
            SimpleValidator.CheckNotPositive((decimal)height, "height");
            SimpleValidator.CheckNotPositive((decimal)width, "width");

            if (Math.Abs(height - width) > 0.001)
            {
                throw new ArgumentException("The sides of a square must be equal");
            }

            Height = height;
            Width  = width;
        }