Rect::Equality Operator (Rect, Rect)

 
equivalentCodeEntityM:System.Windows.Rect.Equals(System.Windows.Rect,System.Windows.Rect)

Compares two rectangles for exact equality.

Namespace:   System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public:
static bool operator ==(
	Rect rect1,
	Rect rect2
)

Parameters

rect1
Type: System.Windows::Rect

The first rectangle to compare.

rect2
Type: System.Windows::Rect

The second rectangle to compare.

Return Value

Type: System::Boolean

true if the rectangles have the same Location and Size values; otherwise, false.

This operation tests for object equality.

In this comparison, two instances of Double::NaN are considered equal.

System_CAPS_noteNote

A rectangle's position and dimensions are described by Double values. Because Double values can lose precision when operated upon, a comparison between two values that are logically equal might fail.

The following example shows how to use the Equality operator to determine if two rectangles are exactly equal.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: