Dumb Rectangle???

  • Thread starter Thread starter Julie
  • Start date Start date
J

Julie

Like most of us, I grew up on Win32 and MFC, and have grown used to what I
consider normal use of basic types/structures. However, I just ran into
another .NET class that seems to be unnecessarily restricted -- Rectangle.

Can someone explain to me _why_ Left, Top, Right, and Bottom are read-only? I
see absolutely *no* value in this, perhaps someone could enlighten me as to why
I can't /set/ these as well...

Thanks
 
Rectangle is defined by it's height, width, and upper left corner (X, Y)
which are values you can "set". :) Thom
 
tbain said:
Rectangle is defined by it's height, width, and upper left corner (X, Y)
which are values you can "set". :) Thom

Extending that logic, then there shouldn't be a getter for l, t, r, & b, but
there is.
 
Julie said:
Extending that logic, then there shouldn't be a
getter for l, t, r, & b, but there is.

Why don't you write a simple wrapper class that (i) allows you to set
Left, Right, Top, and Bottom, and (ii) has an implicit conversion to
Rectangle?

P.
 
Paul said:
Why don't you write a simple wrapper class that (i) allows you to set
Left, Right, Top, and Bottom, and (ii) has an implicit conversion to
Rectangle?

P.
Yes, I realize that is possible, along w/ just converting coordinates (l, t, r,
b) to location/size, but... that isn't my question --

*WHY* was Rectangle originally designed this way?

- I see no benefit/optimization due to not including setters

- I see no reason that excludes rectangle use in terms of l, t, r, b

- I'm not aware of any design paradigms that dictate/indicate that a setter
in this case isn't desirable

Comments, reasons???
 
Back
Top