コード例 #1
0
        public Rectangle(double height, double width)
        {
            SimpleValidator.CheckNotPositive((decimal)height, "height");
            SimpleValidator.CheckNotPositive((decimal)width, "width");

            this.Height = height;
            this.Width  = width;
        }
コード例 #2
0
ファイル: Square.cs プロジェクト: ndvalkov/TelerikAcademy2016
        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;
        }