Esempio n. 1
0
        public override object Clone()
        {
            Rectangle2d r = new Rectangle2d(this.Name);

            r.X = this.X;
            r.Y = this.Y;
            r.W = this.W;
            r.H = this.H;
            return(r);
        }
Esempio n. 2
0
        public override bool Equals(object obj)
        {
            // Check that the object is not null and is of Rectangle2d type.
            if (obj != null && obj.GetType() == typeof(Rectangle2d))
            {
                // Cast the object to a Rectangle2d.
                Rectangle2d rec = (Rectangle2d)obj;

                // Check if the x, y, w, and h values match.
                if (this.X.Equals(rec.X) == true && this.Y.Equals(rec.Y) == true &&
                    this.W.Equals(rec.W) == true && this.H.Equals(rec.H) == true)
                {
                    return(true);
                }
            }

            // Objects do not match.
            return(false);
        }