Point Struct

Represents a pixel coordinate. The origin is the top-left corner of the stored pixels; Y grows downward.

public readonly struct Point : IEquatable<Point>
Implements

Constructors

NameDescription
Point(int, int)Initializes a new instance of the Point struct.

Point(int, int)

Point.cs

Initializes a new instance of the Point struct.

public Point(int x, int y)

Parameters

x int
The horizontal coordinate.
y int
The vertical coordinate.

Properties

NameDescription
EmptyGets the point whose coordinates are zero.
XGets the horizontal coordinate.
YGets the vertical coordinate.

Gets the point whose coordinates are zero.

public static Point Empty { get; }

Property value

Point

Gets the horizontal coordinate.

public int X { get; }

Property value

int

Gets the vertical coordinate.

public int Y { get; }

Property value

int

Methods

NameDescription
Deconstruct(int, int)Deconstructs the point into its coordinates.
Equals(Point)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
GetHashCode()Returns the hash code for this instance.
ToString()Returns the point formatted as ({X}, {Y}).

Deconstruct(int, int)

Point.cs

Deconstructs the point into its coordinates.

public void Deconstruct(out int x, out int y)

Parameters

x int
The horizontal coordinate.
y int
The vertical coordinate.

Equals overloads

Equals(Point)

Point.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Point other)
Parameters
other Point
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Point.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Point.cs

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

ToString()

Point.cs

Returns the point formatted as ({X}, {Y}).

public override string ToString()

Returns

string A string representation of the point.

Operators

NameDescription
operator ==(Point, Point)Compares two points for equality.
operator !=(Point, Point)Compares two points for inequality.

operator ==(Point, Point)

Point.cs

Compares two points for equality.

public static bool operator ==(Point left, Point right)

Parameters

left Point
The first point.
right Point
The second point.

Returns

bool true if both points are equal; otherwise false.

operator !=(Point, Point)

Point.cs

Compares two points for inequality.

public static bool operator !=(Point left, Point right)

Parameters

left Point
The first point.
right Point
The second point.

Returns

bool true if the points differ; otherwise false.