Compare Method (AutomationElement, AutomationElement)

Automation.Compare Method (AutomationElement, AutomationElement)


Compares two UI Automation elements, returning true if both refer to the same UI element.

Namespace:   System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

public static bool Compare(
	AutomationElement el1,
	AutomationElement el2


Type: System.Windows.Automation.AutomationElement

The first UI Automation element to compare.

Type: System.Windows.Automation.AutomationElement

The second UI Automation element to compare.

Return Value

Type: System.Boolean

true if the run time identifiers of the UI elements are the same; otherwise false.

If either of the arguments is a null reference (Nothing in Microsoft Visual Basic .NET), Compare throws an ArgumentNullException exception.

This method is equivalent to the equality operator for AutomationElement objects.

.NET Framework
Available since 3.0
Return to top
© 2016 Microsoft