public IEnumerator <TSource> CreateOrderedEnumerable(IEnumerableSorted <TSource> next) { if (parent == null) { throw new InvalidOperationException(""); } this.SetNext(next); return(parent.CreateOrderedEnumerable(this)); }
public static IOrderedEnumerable <TSource> ThenByDescending <TSource, TKey>(this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey>?comparer) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (keySelector == null) { throw new ArgumentNullException(nameof(keySelector)); } if (comparer == null) { return(source.CreateOrderedEnumerable(keySelector, Comparer <TKey> .Default, true)); } return(source.CreateOrderedEnumerable(keySelector, comparer, true)); }
IOrderedEnumerable <T> IOrderedEnumerable <T> .CreateOrderedEnumerable <TKey1>( Func <T, TKey1> keySelector, IComparer <TKey1> comparer, bool descending) { return(_orderedEnumerable.CreateOrderedEnumerable(keySelector, comparer, descending)); }
static void Example2() { // <Snippet2> // Create an array of strings to sort. string[] fruits = { "apricot", "orange", "banana", "mango", "apple", "grape", "strawberry" }; // First sort the strings by their length. IOrderedEnumerable <string> sortedFruits2 = fruits.OrderBy(fruit => fruit.Length); // Secondarily sort the strings alphabetically, using the default comparer. IOrderedEnumerable <string> sortedFruits3 = sortedFruits2.CreateOrderedEnumerable <string>( fruit => fruit, Comparer <string> .Default, false); // Output the resulting sequence of strings. foreach (string fruit in sortedFruits3) { Console.WriteLine(fruit); } // This code produces the following output: // // apple // grape // mango // banana // orange // apricot // strawberry // </Snippet2> }
public static IOrderedEnumerable <TSource> ThenByDescending <TSource, TKey> ( this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { return(source.CreateOrderedEnumerable <TKey> (keySelector, comparer, true)); }
public static IOrderedEnumerable <TSource> ThenBy <TSource, TKey>(this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector) { if (source == null) { throw Error.ArgumentNull("source"); } return(source.CreateOrderedEnumerable(keySelector, null, false)); }
public static IOrderedEnumerable <TSource> ThenByDescending <TSource, TKey>(this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { if (source == null) { throw Error.ArgumentNull("source"); } return(source.CreateOrderedEnumerable(keySelector, comparer, true)); }
public static IOrderedEnumerable <TElement> ThenByDescending <TElement, TKey> ( this IOrderedEnumerable <TElement> source, Func <TElement, TKey> keySelector ) { return(source.CreateOrderedEnumerable(keySelector, Comparer <TKey> .Default, true)); }
public static IOrderedEnumerable <TSource> ThenBy <TSource, TKey>( this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { ThrowNullException(source); ThrowNullException(keySelector); return(source.CreateOrderedEnumerable(keySelector, comparer, false)); }
public static IOrderedEnumerable <TSource> ThenBy <TSource, TKey>(this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector) { if (source == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source); } return(source.CreateOrderedEnumerable(keySelector, null, false)); }
public static IOrderedEnumerable <TSource> ThenBy <TSource, TKey>(this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { if (source == null) { throw Error.ArgumentNull(nameof(source)); } return(source.CreateOrderedEnumerable(keySelector, comparer, false)); }
public static IOrderedEnumerable <TSource> ThenByDescending <TSource, TKey>(this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey>?comparer) { if (source == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source); } return(source.CreateOrderedEnumerable(keySelector, comparer, true)); }
public static IOrderedEnumerable <TSource> ThenByDescending <TSource, TKey>(this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector) { if (source == null) { throw Error.ArgumentNull(nameof(source)); } return(source.CreateOrderedEnumerable(keySelector, null, true)); }
public static IOrderedEnumerable <TSource> ThenBy <TSource, TKey>( this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { EnsureArgumentIsNotNull(source, nameof(source)); EnsureArgumentIsNotNull(keySelector, nameof(keySelector)); return(source.CreateOrderedEnumerable(keySelector, comparer, false)); }
public static IOrderedEnumerable <TSource> ThenBy <TSource, TKey>( this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { ThrowIfNullSource(source); ThrowIfNullSelector(keySelector); return(source.CreateOrderedEnumerable(keySelector, comparer, true)); }
public static IOrderedEnumerable <TSource> ThenByDescending <TSource, TKey>(this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { LinqCheck.SourceAndKeySelector(source, keySelector); var oe = source as OrderedEnumerable <TSource>; if (oe != null) { return(oe.CreateOrderedEnumerable(keySelector, comparer, true)); } return(source.CreateOrderedEnumerable(keySelector, comparer, true)); }
public static IOrderedEnumerable <TSource> ThenBy <TSource, TKey>(this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { if (source == null) { throw new ArgumentNullException("source"); } if (keySelector == null) { throw new ArgumentNullException("keySelector"); } return(source.CreateOrderedEnumerable(keySelector, comparer, false)); }
public static IOrderedEnumerable <TSource> ThenBy <TSource, TKey>( this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { CheckNullElement(source); CheckNullElement(keySelector); comparer ??= Comparer <TKey> .Default; return(source.CreateOrderedEnumerable(keySelector, comparer, false)); }
public IOrderedEnumerable <T> CreateOrderedEnumerable <TKey>(Func <T, TKey> keySelector, IComparer <TKey> comparer, bool descending) { return(query.CreateOrderedEnumerable <TKey>(keySelector, comparer, descending)); }
public static IOrderedEnumerable <Employee> JoeyThenBy <TKey>(this IOrderedEnumerable <Employee> sources, Func <Employee, TKey> keySelector, IComparer <TKey> comparer) { return(sources.CreateOrderedEnumerable(keySelector, comparer, false)); }
public static IOrderedEnumerable ThenBy <TKey>(this IOrderedEnumerable source, Func <object, TKey> keySelector) { Error.ThrowIfNull(source, nameof(source)); return(source.CreateOrderedEnumerable <TKey>(keySelector, null, false)); }
public IOrderedEnumerable <T> CreateOrderedEnumerable <TKey>(Func <T, TKey> keySelector, IComparer <TKey> comparer, bool descending) => new WhereOrderedEnumerable <T>(source.CreateOrderedEnumerable(keySelector, comparer, descending), predicate);
public static IOrderedEnumerable <TSource> ThenBy <TSource, TKey>( this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer = null) => source.CreateOrderedEnumerable(keySelector, comparer, descending: false);
public IOrderedEnumerable <TSource> ThenBySample <TSource>(IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector) { return(source.CreateOrderedEnumerable(item => this.GetOrderKey(keySelector(item)), Comparer <int> .Default, false)); }
internal static IOrderedEnumerable <TSource> ThenByDescending <TSource, TKey>( this IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer = null) => source.CreateOrderedEnumerable(keySelector, comparer, true);
public static IOrderedEnumerable <TSource> ThenByDescending <TSource, TKey>(IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector) where TKey : IComparable <TKey> { return(source.CreateOrderedEnumerable((x, y) => keySelector(y).CompareTo(keySelector(x)))); }
public static IOrderedEnumerable ThenByDescending <TKey>(this IOrderedEnumerable source, Func <object, TKey> keySelector, IComparer comparer) { Error.ThrowIfNull(source, nameof(source)); return(source.CreateOrderedEnumerable <TKey>(keySelector, comparer, true)); }