<Type Name="IComparer" FullName="System.Collections.IComparer" FullNameSP="System_Collections_IComparer" Maintainer="ecma">
  <TypeSignature Language="ILASM" Value=".class interface public abstract IComparer" />
  <TypeSignature Language="C#" Value="public interface IComparer" />
  <MemberOfLibrary>BCL</MemberOfLibrary>
  <AssemblyInfo>
    <AssemblyName>mscorlib</AssemblyName>
    <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey>
    <AssemblyVersion>2.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Docs>
    <summary>
      <para> Provides a mechanism to customize the sort
      ordering of a collection.</para>
    </summary>
    <remarks>
      <para> The default implementation of this interface
      is <see cref="T:System.Collections.Comparer" />
      .</para>
      <para>
        <block subset="none" type="note">
          <see cref="T:System.Collections.IComparer" /> contains the <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" /> method. The consumer of an object
      should call this method when sorting members of a collection.</block>
      </para>
    </remarks>
  </Docs>
  <Members>
    <Member MemberName="Compare">
      <MemberSignature Language="ILASM" Value=".method public hidebysig virtual abstract int32 Compare(object x, object y)" />
      <MemberSignature Language="C#" Value="public int Compare (object x, object y);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Int32</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="x" Type="System.Object" />
        <Parameter Name="y" Type="System.Object" />
      </Parameters>
      <Docs>
        <param name="x">First <see cref="T:System.Object" /> to compare.</param>
        <param name="y">Second <see cref="T:System.Object" /> to compare.</param>
        <summary>
          <para> Returns the sort order of two <see cref="T:System.Object" /> instances.</para>
        </summary>
        <returns>
          <para>The return value is a negative number, zero, or a positive number reflecting the sort order of <paramref name="x" /> as compared to <paramref name="y" />. For non-zero return values, the exact value returned by this method is unspecified. The following table defines the return value:</para>
          <list type="table">
            <listheader>
              <term>Value</term>
              <description>Condition</description>
            </listheader>
            <item>
              <term> A negative number</term>
              <description>
                <paramref name="x" /> &lt; <paramref name="y" />.</description>
            </item>
            <item>
              <term> Zero</term>
              <description>
                <paramref name="x" /> == <paramref name="y" />.</description>
            </item>
            <item>
              <term> A positive number</term>
              <description>
                <paramref name="x" /> &gt; <paramref name="y" />.</description>
            </item>
          </list>
        </returns>
        <remarks>
          <block subset="none" type="behaviors">
            <para>For any objects A, B, and C, the following are required to be true: </para>
            <para>
              <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" /> (A, A) is required to
      return zero.
      </para>
            <para> If
   <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" />(A, B)
      returns zero, then <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" /> (B, A) is required to
      return zero.
      </para>
            <para> If <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" />(A, B) returns zero and <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" />(B, C)
   returns zero then <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" /> (A, C) is required to
   return zero.
   </para>
            <para> If <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" />(A, B) returns a value other than
zero, then <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" /> (B,
A)
is required to return a value of the
opposite sign.</para>
            <para> If <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" />(A, B) returns a value x not equal to
zero, and <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" />(B, C)
returns
a value y of the same sign as x, then <see cref="M:System.Collections.IComparer.Compare(System.Object,System.Object)" /> (A,
C) is required to return
a value of the same sign as x
and y.</para>
          </block>
          <block subset="none" type="note">
            <para>The exact ordering of this method is unspecified. The intent of the method
      is to provide a mechanism that orders instances of a class in a manner that
      is consistent with the mathematical definitions of the relational operators (&lt;,
      &gt;, and ==), without regard for class-specific definitions of the
      operators.</para>
          </block>
          <block subset="none" type="usage">
            <para>This interface is used in conjunction with the <see cref="M:System.Array.Sort(System.Array)" /> and <see cref="M:System.Array.BinarySearch(System.Array,System.Object)" qualify="true" /> methods.
</para>
          </block>
        </remarks>
      </Docs>
      <Excluded>0</Excluded>
    </Member>
  </Members>
  <TypeExcluded>0</TypeExcluded>
  <Interfaces />
  <Attributes>
    <Attribute>
      <AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
    </Attribute>
  </Attributes>
</Type>
