Struct Rect
Rectangle struct
Namespace
Syntax
public struct Rect
Constructors
Rect(int, int, int, int)
Makes a new rectangle instance
Declaration
public Rect(int width, int height, int x, int y)
Parameters
| Name | Type | Description |
|---|---|---|
| width | int | A zero-based width |
| height | int | A zero-based height |
| x | int | A zero-based X coordinate |
| y | int | A zero-based Y coordinate |
Rect(Size, Coordinate)
Makes a new rectangle instance
Declaration
public Rect(Size size, Coordinate coord)
Parameters
| Name | Type | Description |
|---|---|---|
| size | Size | Zero-based width and height |
| coord | Coordinate | Zero-based X and Y coordinates |
Properties
Coordinate
Coordinate of the rectangle (starting point, upper left corner)
CoordinateEnd
Coordinate of the rectangle (ending point, lower right corner)
CoordinateLowerLeft
Coordinate of the rectangle (lower left corner)
CoordinateUpperRight
Coordinate of the rectangle (upper right corner)
Size
Size of the rectangle
Methods
Equals(object?)
Returns
bool
Declaration
public override bool Equals(object? obj)
Parameters
| Name | Type | Description |
|---|---|---|
| obj | object |
Overrides
System.ValueType.Equals(object)
Equals(Rect)
GetHashCode()
Returns
int
Declaration
public override int GetHashCode()
Overrides
System.ValueType.GetHashCode()
ToString()
Generates a string containing rectangle info
Returns
string
Rectangle info in a string
Declaration
public override string ToString()
Overrides
System.ValueType.ToString()
Operators
operator ==(Rect, Rect)
Returns
bool
Declaration
public static bool operator ==(Rect left, Rect right)
Parameters
| Name | Type | Description |
|---|---|---|
| left | Rect | |
| right | Rect |