Επεξεργασία

Κοινή χρήση μέσω


Point.Equals Method

Definition

Compares two Point structures for equality.

Overloads

Equals(Object)

Determines whether the specified Object is a Point and whether it contains the same coordinates as this Point.

Equals(Point)

Compares two Point structures for equality.

Equals(Point, Point)

Compares two Point structures for equality.

Equals(Object)

Determines whether the specified Object is a Point and whether it contains the same coordinates as this Point.

public:
 override bool Equals(System::Object ^ o);
public override bool Equals (object o);
override this.Equals : obj -> bool
Public Overrides Function Equals (o As Object) As Boolean

Parameters

o
Object

The Object to compare.

Returns

true if o is a Point and contains the same X and Y values as this Point; otherwise, false.

Examples

The following example shows how to check if two Point structures are equal using the non-static Equals method.

private Boolean nonStaticEqualsExample()
{

    Point point1 = new Point(10, 5);
    Point point2 = new Point(15, 40);

    // Check if the two points are equal using the non-static Equals method.
    // areEqual is false
    Boolean areEqual = point1.Equals(point2);	

    return areEqual;
}

Remarks

Point coordinates are described using Double values. Because the value of a Double can lose precision when operated upon, a comparison between two Point values that are logically equal might fail.

See also

Applies to

Equals(Point)

Compares two Point structures for equality.

public:
 bool Equals(System::Windows::Point value);
public bool Equals (System.Windows.Point value);
override this.Equals : System.Windows.Point -> bool
Public Function Equals (value As Point) As Boolean

Parameters

value
Point

The point to compare to this instance.

Returns

true if both Point structures contain the same X and Y values; otherwise, false.

Remarks

Point coordinates are expressed using Double values. Because the value of a Double can lose precision when operated on, a comparison between two Point values that are logically equal might fail.

See also

Applies to

Equals(Point, Point)

Compares two Point structures for equality.

public:
 static bool Equals(System::Windows::Point point1, System::Windows::Point point2);
public static bool Equals (System.Windows.Point point1, System.Windows.Point point2);
static member Equals : System.Windows.Point * System.Windows.Point -> bool
Public Shared Function Equals (point1 As Point, point2 As Point) As Boolean

Parameters

point1
Point

The first point to compare.

point2
Point

The second point to compare.

Returns

true if point1 and point2 contain the same X and Y values; otherwise, false.

Examples

The following example shows how to check if two Point structures are equal using the static Equals method.

private Boolean staticEqualsExample()
{

    Point point1 = new Point(10, 5);
    Point point2 = new Point(15, 40);

    // Check if the two points are equal using the static Equals method.
    // areEqual is false
    Boolean areEqual = Point.Equals(point1, point2);

    return areEqual;
}

Remarks

Point coordinates are described using Double values. Because the value of a Double can lose precision when operated upon, a comparison between two Point values that are logically equal might fail.

See also

Applies to