コード例 #1
0
        public static T MaxBy <T>(this IEnumerable <T> @this, IComparer <T> comparer = null) where T : class
        {
            if (comparer == null)
            {
                comparer = Comparer <T> .Default;
            }

            return(@this.MinBy(comparer.Revert()));
        }
コード例 #2
0
        public static ICollection <T> SortLast <T>(this IEnumerable <T> @this, int first, IComparer <T> comparer = null)
        {
            IComparer <T> IntComparer = comparer ?? Comparer <T> .Default;

            return(@this.SortFirst(first, IntComparer.Revert()));
        }