Automation.Compare メソッド

定義

指定したパラメーターを比較し、それらが同じユーザー インターフェイス (UI) 要素を参照しているかどうかを確認します。

オーバーロード

Compare(Int32[], Int32[])

実行時識別子 (ID) を含む 2 つの整数配列を比較して、その内容が同じかどうかを判断します。

Compare(AutomationElement, AutomationElement)

2 つのUI オートメーション要素を比較しtrue、両方が同じ UI 要素を参照しているかどうかを返します。

Compare(Int32[], Int32[])

実行時識別子 (ID) を含む 2 つの整数配列を比較して、その内容が同じかどうかを判断します。

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

パラメーター

runtimeId1
Int32[]

最初に比較するランタイム ID。

runtimeId2
Int32[]

2 番目に比較するランタイム ID。

戻り値

Boolean

true 比較されたランタイム ID が同じユーザー インターフェイス (UI) 要素を参照している場合。それ以外の場合 falseは .

次の例の関数は、実行時 ID が実行時 ID の一覧に含まれているかどうかを判断します。

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

注釈

いずれかの引数が null 参照Nothing (Visual Basic) のCompare場合は、例外がArgumentNullExceptionスローされます。

こちらもご覧ください

適用対象

Compare(AutomationElement, AutomationElement)

2 つのUI オートメーション要素を比較しtrue、両方が同じ UI 要素を参照しているかどうかを返します。

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

パラメーター

el1
AutomationElement

比較する最初のUI オートメーション要素。

el2
AutomationElement

比較する 2 番目のUI オートメーション要素。

戻り値

Boolean

true UI 要素の実行時識別子が同じ場合。それ以外の場合 falseは .

注釈

いずれかの引数が null 参照Nothing (Visual Basic) のCompare場合は、例外がArgumentNullExceptionスローされます。

このメソッドは、オブジェクトの等値演算子に AutomationElement 相当します。

こちらもご覧ください

適用対象