Search code examples
c#.netsystem.drawing

Rectangle.X vs Rectangle.Left


I see that the System.Drawing.Rectangle class has two sets of properties:

  • X, Y, Width, Height
  • Left, Top, Right, Bottom

The difference between Width and Right are obvious. But I don't understand the reasoning behind the Left and Top properties.

Can these be used interchangeably along with X and Y, or am I missing something obvious? Is there a convention for when I should use which?


Solution

  • Left is purely a wrapper around the X property.

    The same goes for Top / Y.

    As noted by hakononakani, they are both readonly - in order to set the properties you need to use X and Y.