1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
<?xml version="1.0" encoding="utf-8"?>
<Type Name="Comparer<T>" FullName="System.Collections.Generic.Comparer<T>">
<TypeSignature Language="C#" Value="public abstract class Comparer<T> : System.Collections.Generic.IComparer<T>, System.Collections.IComparer" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract serializable beforefieldinit Comparer`1<T> extends System.Object implements class System.Collections.Generic.IComparer`1<!T>, class System.Collections.IComparer" />
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Collections.Generic.IComparer<T></InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Collections.IComparer</InterfaceName>
</Interface>
</Interfaces>
<Docs>
<typeparam name="T">To be added.</typeparam>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Derive from this class to provide a custom implementation of the <see cref="T:System.Collections.Generic.IComparer`1" /> interface for use with collection classes such as the <see cref="T:System.Collections.Generic.SortedList`2" /> and <see cref="T:System.Collections.Generic.SortedDictionary`2" /> generic classes.</para>
<para>The difference between deriving from the <see cref="T:System.Collections.Generic.Comparer`1" /> class and implementing the <see cref="T:System.IComparable" /> interface is as follows:</para>
<list type="bullet">
<item>
<para>To specify how two objects should be compared by default, implement the <see cref="T:System.IComparable" /> interface in your class. This ensures that sort operations will use the default comparison code that you provided.</para>
</item>
<item>
<para>To define a comparer to use instead of the default comparer, derive from the <see cref="T:System.Collections.Generic.Comparer`1" /> class. You can then use this comparer in sort operations that take a comparer as a parameter.</para>
</item>
</list>
<para>The object returned by the <see cref="P:System.Collections.Generic.Comparer`1.Default" /> property uses the <see cref="T:System.IComparable`1" /> generic interface (IComparable<T> in C#, IComparable(Of T) in Visual Basic) to compare two objects. If type <paramref name="T" /> does not implement the <see cref="T:System.IComparable`1" /> generic interface, the <see cref="P:System.Collections.Generic.Comparer`1.Default" /> property returns a <see cref="T:System.Collections.Generic.Comparer`1" /> that uses the <see cref="T:System.IComparable" /> interface.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Provides a base class for implementations of the <see cref="T:System.Collections.Generic.IComparer`1" /> generic interface.</para>
</summary>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected Comparer ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the <see cref="T:System.Collections.Generic.Comparer`1" /> class.</para>
</summary>
</Docs>
</Member>
<Member MemberName="Compare">
<MemberSignature Language="C#" Value="public abstract int Compare (T x, T y);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance int32 Compare(!T x, !T y) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="x" Type="T" />
<Parameter Name="y" Type="T" />
</Parameters>
<Docs>
<param name="x">To be added.</param>
<param name="y">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
<since version=".NET 2.0" />
</Docs>
</Member>
<Member MemberName="Create">
<MemberSignature Language="C#" Value="public static System.Collections.Generic.Comparer<T> Create (Comparison<T> comparison);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.Comparer`1<!T> Create(class System.Comparison`1<!T> comparison) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.Generic.Comparer<T></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="comparison" Type="System.Comparison<T>" />
</Parameters>
<Docs>
<param name="comparison">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Default">
<MemberSignature Language="C#" Value="public static System.Collections.Generic.Comparer<T> Default { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.Collections.Generic.Comparer`1<!T> Default" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.Generic.Comparer<T></ReturnType>
</ReturnValue>
<Docs>
<value>To be added.</value>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The <see cref="T:System.Collections.Generic.Comparer`1" /> returned by this property uses the <see cref="T:System.IComparable`1" /> generic interface (IComparable<T> in C#, IComparable(Of T) in Visual Basic) to compare two objects. If type <paramref name="T" /> does not implement the <see cref="T:System.IComparable`1" /> generic interface, this property returns a <see cref="T:System.Collections.Generic.Comparer`1" /> that uses the <see cref="T:System.IComparable" /> interface.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Returns a default sort order comparer for the type specified by the generic argument.</para>
</summary>
</Docs>
</Member>
<Member MemberName="System.Collections.IComparer.Compare">
<MemberSignature Language="C#" Value="int IComparer.Compare (object x, object y);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance int32 System.Collections.IComparer.Compare(object x, object y) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="x" Type="System.Object" />
<Parameter Name="y" Type="System.Object" />
</Parameters>
<Docs>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>This method is a wrapper for the <see cref="M:System.Collections.Generic.Comparer`1.Compare(`0,`0)" /> method, so <paramref name="obj" /> must be cast to the type specified by the generic argument <paramref name="T" /> of the current instance. If it cannot be cast to <paramref name="T" />, an <see cref="T:System.ArgumentException" /> is thrown.</para>
<para>Comparing null with any reference type is allowed and does not generate an exception. When sorting, null is considered to be less than any other object.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>A signed integer that indicates the relative values of <paramref name="x" /> and <paramref name="y" />, as shown in the following table.</para>
<list type="table">
<listheader>
<item>
<term>
<para>Value </para>
</term>
<description>
<para>Meaning </para>
</description>
</item>
</listheader>
<item>
<term>
<para>Less than zero</para>
</term>
<description>
<para>
<paramref name="x" /> is less than <paramref name="y" />.</para>
</description>
</item>
<item>
<term>
<para>Zero</para>
</term>
<description>
<para>
<paramref name="x" /> equals <paramref name="y" />.</para>
</description>
</item>
<item>
<term>
<para>Greater than zero</para>
</term>
<description>
<para>
<paramref name="x" /> is greater than <paramref name="y" />.</para>
</description>
</item>
</list>
</returns>
<param name="x">
<attribution license="cc4" from="Microsoft" modified="false" />The first object to compare.</param>
<param name="y">
<attribution license="cc4" from="Microsoft" modified="false" />The second object to compare.</param>
</Docs>
</Member>
</Members>
</Type>
|