コード例 #1
0
 /// <summary>
 /// Creates a comparer that will sort elements in descending order based on the values returned by the provided
 /// selector. The values will be compared using the default comparer for the return type of the selector.
 /// </summary>
 /// <typeparam name="TValue">The value type.</typeparam>
 /// <param name="selector">
 /// A function supplying the values for the comparer.
 /// </param>
 /// <returns>A comparer.</returns>
 public static IComparer <T> OrderByDescending <TValue>(Func <T, TValue> selector) => ComparerChainingExtensions.ThenByDescending(null, selector);
コード例 #2
0
 /// <summary>
 /// Creates a comparer that will sort elements in ascending order based on the values returned by the provided
 /// selector. The selector values will be compared using the provided comparer or the default comparer for the
 /// return type of the selector if no comparer is specified.
 /// </summary>
 /// <typeparam name="TValue">The value type.</typeparam>
 /// <param name="selector">
 /// A function supplying the values for the comparer.
 /// </param>
 /// <param name="comparer">
 /// The comparer to use when comparing the values returned by the selector.
 /// The default comparer for that type will be used if this parameter is null.
 /// </param>
 /// <returns>A comparer.</returns>
 public static IComparer <T> OrderBy <TValue>(Func <T, TValue> selector, IComparer <TValue> comparer) => ComparerChainingExtensions.ThenBy(null, selector, comparer);