# Rectangle Rectangle Struct

## Definition

Struct defining a rectangle, using doubles.

```
[System.Diagnostics.DebuggerDisplay("X={X}, Y={Y}, Width={Width}, Height={Height}")]
[Xamarin.Forms.TypeConverter(typeof(Xamarin.Forms.RectangleTypeConverter))]
public struct Rectangle
```

`type Rectangle = struct`

- Inheritance

- Attributes

## Remarks

Application developers should be aware of the limits of floating-point representations, specifically the possibility of incorrect comparisons and equality checks for values with small differences. David Goldberg's paper

## Constructors

Rectangle(Point, Size) Rectangle(Point, Size) |
Creates a new Rectangle object with its top left corner at |

Rectangle(Double, Double, Double, Double) Rectangle(Double, Double, Double, Double) |
Creates a new Rectangle object with its top left corner at ( |

## Fields

Zero Zero |
The Rectangle at {0,0} whose Size is {0,0}. |

## Properties

Bottom Bottom |
The bottom of the Rectangle. |

Center Center | |

Height Height |
Extent along the Y axis. |

IsEmpty IsEmpty |
Whether |

Left Left |
The position of the Rectangle on the X axis. |

Location Location | |

Right Right |
The furthest extent along the X axis. |

Size Size |
The extent of the Rectangle along its X and Y axes. |

Top Top |
The top of the Rectangle. |

Width Width |
The extent of this Rectangle along the X axis. |

X X |
The position of this Rectangle on the X axis. |

Y Y |
The position of this Rectangle on the Y axis. |

## Methods

Contains(Point) Contains(Point) |
Whether the |

Contains(Rectangle) Contains(Rectangle) |
Whether |

Contains(Double, Double) Contains(Double, Double) |
Whether the point described by |

Deconstruct(Double, Double, Double, Double) Deconstruct(Double, Double, Double, Double) |
Stores the components of the location and size of the rectangle in the corresponding arguments. |

Equals(Rectangle) Equals(Rectangle) |
Whether a Rectangle has exactly the same values as |

Equals(Object) Equals(Object) |
Whether an Object is a Rectangle and has exactly the same values as |

FromLTRB(Double, Double, Double, Double) FromLTRB(Double, Double, Double, Double) |
Factory method to create a Rectangle from |

GetHashCode() GetHashCode() |
The hashcode for the Rectangle. |

Inflate(Size) Inflate(Size) |
Creates a Rectangle whose borders are inflated in every direction. |

Inflate(Double, Double) Inflate(Double, Double) |
Creates a Rectangle whose borders are inflated in every direction. |

Intersect(Rectangle) Intersect(Rectangle) |
A new Rectangle that is the intersection of |

Intersect(Rectangle, Rectangle) Intersect(Rectangle, Rectangle) |
A new Rectangle that is the intersection of |

IntersectsWith(Rectangle) IntersectsWith(Rectangle) |
Whether |

Offset(Point) Offset(Point) | |

Offset(Double, Double) Offset(Double, Double) | |

Round() Round() |
Returns a new Rectangle whose values have been rounded to their nearest integral value. |

ToString() ToString() |
A human-readable description of the Rectangle. |

Union(Rectangle) Union(Rectangle) |
A new Rectangle whose bounds cover the union of |

Union(Rectangle, Rectangle) Union(Rectangle, Rectangle) |
A new Rectangle whose bounds cover the union of |

## Operators

Equality(Rectangle, Rectangle) Equality(Rectangle, Rectangle) |
Whether two Rectangles have equal values. |

Inequality(Rectangle, Rectangle) Inequality(Rectangle, Rectangle) |
Whether two Rectangles have unequal values. |

## Applies to

## Feedback

Send feedback about:

Loading feedback...