Automation.Compare メソッド

定義

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

オーバーロード

名前 説明
Compare(Int32[], Int32[])

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

Compare(AutomationElement, AutomationElement)

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

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。

返品

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 参照 (Visual Basic の Nothing) の場合、CompareArgumentNullException 例外をスローします。

こちらもご覧ください

適用対象

Compare(AutomationElement, AutomationElement)

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

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 オートメーション要素。

返品

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

注釈

いずれかの引数が null 参照 (Visual Basic の Nothing) の場合、CompareArgumentNullException 例外をスローします。

このメソッドは、 AutomationElement オブジェクトの等値演算子と同じです。

こちらもご覧ください

適用対象