Automation.Compare Método

Definición

Compara los parámetros especificados para determinar si hacen referencia al mismo elemento de la interfaz de usuario.

Sobrecargas

Compare(Int32[], Int32[])

Compara dos matrices de enteros que contienen identificadores en tiempo de ejecución (identificadores) para determinar si su contenido es el mismo.

Compare(AutomationElement, AutomationElement)

Compara dos elementos Automatización de la interfaz de usuario, devolviendo true si ambos hacen referencia al mismo elemento de interfaz de usuario.

Compare(Int32[], Int32[])

Compara dos matrices de enteros que contienen identificadores en tiempo de ejecución (identificadores) para determinar si su contenido es el mismo.

public:
 static bool Compare(cli::array <int> ^ runtimeId1, cli::array <int> ^ runtimeId2);
public static bool Compare (int[] runtimeId1, int[] runtimeId2);
static member Compare : int[] * int[] -> bool
Public Shared Function Compare (runtimeId1 As Integer(), runtimeId2 As Integer()) As Boolean

Parámetros

runtimeId1
Int32[]

Primer identificador de tiempo de ejecución que se va a comparar.

runtimeId2
Int32[]

Segundo identificador de tiempo de ejecución que se va a comparar.

Devoluciones

Boolean

true si los identificadores en tiempo de ejecución comparados hacen referencia al mismo elemento de interfaz de usuario (UI); de lo contrario, false.

Ejemplos

La siguiente función de ejemplo determina si un identificador en tiempo de ejecución está en una lista de identificadores en tiempo de ejecución.

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;
}
Private Function RuntimeIdListed(ByVal runtimeId() As Integer, ByVal runtimeIds As ArrayList) As Integer 
    Dim x As Integer
    For x = 0 To runtimeIds.Count - 1
        Dim listedId As Integer() = CType(runtimeIds(x), Integer())
        If Automation.Compare(listedId, runtimeId) Then
            Return x
        End If
    Next x
    Return - 1

End Function 'RuntimeIdListed

Comentarios

Si alguno de los argumentos es una referencia nula (Nothing en Visual Basic), Compare produce una ArgumentNullException excepción.

Consulte también

Se aplica a

Compare(AutomationElement, AutomationElement)

Compara dos elementos Automatización de la interfaz de usuario, devolviendo true si ambos hacen referencia al mismo elemento de interfaz de usuario.

public:
 static bool Compare(System::Windows::Automation::AutomationElement ^ el1, System::Windows::Automation::AutomationElement ^ el2);
public static bool Compare (System.Windows.Automation.AutomationElement el1, System.Windows.Automation.AutomationElement el2);
static member Compare : System.Windows.Automation.AutomationElement * System.Windows.Automation.AutomationElement -> bool
Public Shared Function Compare (el1 As AutomationElement, el2 As AutomationElement) As Boolean

Parámetros

el1
AutomationElement

Primer elemento Automatización de la interfaz de usuario que se va a comparar.

el2
AutomationElement

El segundo elemento Automatización de la interfaz de usuario que se va a comparar.

Devoluciones

Boolean

true si los identificadores en tiempo de ejecución de los elementos de la interfaz de usuario son los mismos; de lo contrario, false.

Comentarios

Si alguno de los argumentos es una referencia nula (Nothing en Visual Basic), Compare produce una ArgumentNullException excepción.

Este método es equivalente al operador de igualdad para AutomationElement los objetos .

Consulte también

Se aplica a