Compare Two Points
One of the functionalities available in the Point
and PointF
classes is the Equals()
method. This method is used to compare two points in terms of their x and y coordinates and returns a boolean value.
In the code snippet above, the Equals()
method compares two different points. Since it is a method that belongs to the Point class, you can access this method with a *Point** object and using another Point
object as its argument to be compared. It only compares the x and y coordinates of the two different points.
It's important to note that this method can only be used with Point
objects of the same class. Attempting to use this method to compare two points of different classes, such as comparing Point and PointF
classes, will result in a NullReferenceException
being thrown at runtime.