StructuralComparisons.StructuralComparer プロパティ

定義

2 つのオブジェクトの構造比較を実行する定義済みのオブジェクトを取得します。

public:
 static property System::Collections::IComparer ^ StructuralComparer { System::Collections::IComparer ^ get(); };
public static System.Collections.IComparer StructuralComparer { get; }
static member StructuralComparer : System.Collections.IComparer
Public Shared ReadOnly Property StructuralComparer As IComparer

プロパティ値

2 つのコレクション オブジェクトの構造比較を実行するために使用される定義済みのオブジェクト。

注釈

このプロパティによって返される IComparer オブジェクトが、 Array.IStructuralComparable.CompareTo(Object, IComparer)Tuple<T1,T2,T3>.IStructuralComparable.CompareTo(Object, IComparer)などのコレクション オブジェクトの比較メソッドに渡されると、配列の各メンバーまたはタプルの各コンポーネントに対して、その Compare メソッドが呼び出されます。 Compare メソッドのこの実装は、コレクション オブジェクトの各項目を別のコレクション オブジェクトの対応する項目と比較すると、次のように動作します。

  • null 2 つの項目が等しいと見なされ、null 項目が null 以外の項目より小さいと見なされます。

  • 比較の最初の項目を IStructuralComparable オブジェクトにキャストできる場合 (つまり、 IStructuralComparable インターフェイスを実装するコレクション オブジェクトの場合)、 CompareTo メソッドを呼び出します。

  • 比較の最初の項目を IStructuralComparable オブジェクトにキャストできない場合 (つまり、 IStructuralComparable インターフェイスを実装するコレクション オブジェクトでない場合)、 Comparer.Default.Compare メソッドを呼び出します。

適用対象

こちらもご覧ください