@@ -23,7 +23,7 @@ public static partial class Enumerable
2323 /// This method compares elements by using the default comparer <see cref="Comparer{T}.Default"/>.
2424 /// </remarks>
2525 public static IOrderedEnumerable < T > Order < T > ( this IEnumerable < T > source ) =>
26- OrderBy ( source , static element => element ) ;
26+ new OrderedEnumerable < T , T > ( source , static element => element , null , false , null ) ;
2727
2828 /// <summary>
2929 /// Sorts the elements of a sequence in ascending order.
@@ -42,7 +42,7 @@ public static IOrderedEnumerable<T> Order<T>(this IEnumerable<T> source) =>
4242 /// If comparer is <see langword="null"/>, the default comparer <see cref="Comparer{T}.Default"/> is used to compare elements.
4343 /// </remarks>
4444 public static IOrderedEnumerable < T > Order < T > ( this IEnumerable < T > source , IComparer < T > comparer ) =>
45- OrderBy ( source , static element => element , comparer ) ;
45+ new OrderedEnumerable < T , T > ( source , static element => element , comparer , false , null ) ;
4646
4747 public static IOrderedEnumerable < TSource > OrderBy < TSource , TKey > ( this IEnumerable < TSource > source , Func < TSource , TKey > keySelector ) =>
4848 new OrderedEnumerable < TSource , TKey > ( source , keySelector , null , false , null ) ;
@@ -66,7 +66,7 @@ public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerabl
6666 /// This method compares elements by using the default comparer <see cref="Comparer{T}.Default"/>.
6767 /// </remarks>
6868 public static IOrderedEnumerable < T > OrderDescending < T > ( this IEnumerable < T > source ) =>
69- OrderByDescending ( source , static element => element ) ;
69+ new OrderedEnumerable < T , T > ( source , static element => element , null , true , null ) ;
7070
7171 /// <summary>
7272 /// Sorts the elements of a sequence in descending order.
@@ -85,13 +85,27 @@ public static IOrderedEnumerable<T> OrderDescending<T>(this IEnumerable<T> sourc
8585 /// If comparer is <see langword="null"/>, the default comparer <see cref="Comparer{T}.Default"/> is used to compare elements.
8686 /// </remarks>
8787 public static IOrderedEnumerable < T > OrderDescending < T > ( this IEnumerable < T > source , IComparer < T > comparer ) =>
88- OrderByDescending ( source , static element => element , comparer ) ;
88+ new OrderedEnumerable < T , T > ( source , static element => element , comparer , true , null ) ;
8989
90- public static IOrderedEnumerable < TSource > OrderByDescending < TSource , TKey > ( this IEnumerable < TSource > source , Func < TSource , TKey > keySelector ) =>
91- new OrderedEnumerable < TSource , TKey > ( source , keySelector , null , true , null ) ;
90+ public static IOrderedEnumerable < TSource > OrderByDescending < TSource , TKey > ( this IEnumerable < TSource > source , Func < TSource , TKey > keySelector )
91+ {
92+ if ( keySelector is null )
93+ {
94+ ThrowHelper . ThrowArgumentNullException ( ExceptionArgument . keySelector ) ;
95+ }
96+
97+ return new OrderedEnumerable < TSource , TKey > ( source , keySelector , null , true , null ) ;
98+ }
9299
93- public static IOrderedEnumerable < TSource > OrderByDescending < TSource , TKey > ( this IEnumerable < TSource > source , Func < TSource , TKey > keySelector , IComparer < TKey > ? comparer ) =>
94- new OrderedEnumerable < TSource , TKey > ( source , keySelector , comparer , true , null ) ;
100+ public static IOrderedEnumerable < TSource > OrderByDescending < TSource , TKey > ( this IEnumerable < TSource > source , Func < TSource , TKey > keySelector , IComparer < TKey > ? comparer )
101+ {
102+ if ( keySelector is null )
103+ {
104+ ThrowHelper . ThrowArgumentNullException ( ExceptionArgument . keySelector ) ;
105+ }
106+
107+ return new OrderedEnumerable < TSource , TKey > ( source , keySelector , comparer , true , null ) ;
108+ }
95109
96110 public static IOrderedEnumerable < TSource > ThenBy < TSource , TKey > ( this IOrderedEnumerable < TSource > source , Func < TSource , TKey > keySelector )
97111 {
0 commit comments