Automation.Compare Method (Int32[], Int32[])


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Compares two integer arrays containing run-time identifiers (IDs) to determine whether their content is the same.

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

public static bool Compare(
	int[] runtimeId1,
	int[] runtimeId2


Type: System.Int32[]

The first run-time ID to compare.

Type: System.Int32[]

The second run-time ID to compare.

Return Value

Type: System.Boolean

true if the compared run-time IDs refer to the same user interface (UI) element; otherwise false.

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

The following example function determines whether a run-time ID is in a list of run-time IDs.

private int RuntimeIdListed(int[] runtimeId, ArrayList runtimeIds)
    for (int x = 0; x < runtimeIds.Count; x++)
        int[] listedId = (int[])runtimeIds[x];
        if (Automation.Compare(listedId, runtimeId))
            return x;
    return -1;

.NET Framework
Available since 3.0
Return to top