コード例 #1
0
        public IEnumerator <TSource> CreateOrderedEnumerable(IEnumerableSorted <TSource> next)
        {
            if (parent == null)
            {
                throw new InvalidOperationException("");
            }

            this.SetNext(next);
            return(parent.CreateOrderedEnumerable(this));
        }
コード例 #2
0
ファイル: Enumerable.cs プロジェクト: csharpHub/Theraot
 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));
 }
コード例 #3
0
 IOrderedEnumerable <T> IOrderedEnumerable <T> .CreateOrderedEnumerable <TKey1>(
     Func <T, TKey1> keySelector,
     IComparer <TKey1> comparer,
     bool descending)
 {
     return(_orderedEnumerable.CreateOrderedEnumerable(keySelector, comparer, descending));
 }
コード例 #4
0
        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>
        }
コード例 #5
0
 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));
 }
コード例 #6
0
 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));
 }
コード例 #7
0
 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));
 }
コード例 #8
0
 public static IOrderedEnumerable <TElement> ThenByDescending <TElement, TKey>
 (
     this IOrderedEnumerable <TElement> source,
     Func <TElement, TKey> keySelector
 )
 {
     return(source.CreateOrderedEnumerable(keySelector, Comparer <TKey> .Default, true));
 }
コード例 #9
0
 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));
 }
コード例 #10
0
        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));
        }
コード例 #11
0
ファイル: OrderBy.cs プロジェクト: karthikrajkumar/demo
        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));
        }
コード例 #12
0
        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));
        }
コード例 #13
0
ファイル: OrderBy.cs プロジェクト: karthikrajkumar/demo
        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));
        }
コード例 #14
0
        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));
        }
コード例 #15
0
        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));
        }
コード例 #16
0
ファイル: Enumerable.net30.cs プロジェクト: lin5/Theraot
        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));
        }
コード例 #17
0
ファイル: ThenBy.cs プロジェクト: DVLKinoMan/DZD
 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));
 }
コード例 #18
0
        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));
        }
コード例 #19
0
 public IOrderedEnumerable <T> CreateOrderedEnumerable <TKey>(Func <T, TKey> keySelector, IComparer <TKey> comparer, bool descending)
 {
     return(query.CreateOrderedEnumerable <TKey>(keySelector, comparer, descending));
 }
コード例 #20
0
 public static IOrderedEnumerable <Employee> JoeyThenBy <TKey>(this IOrderedEnumerable <Employee> sources, Func <Employee, TKey> keySelector, IComparer <TKey> comparer)
 {
     return(sources.CreateOrderedEnumerable(keySelector, comparer, false));
 }
コード例 #21
0
 public static IOrderedEnumerable ThenBy <TKey>(this IOrderedEnumerable source, Func <object, TKey> keySelector)
 {
     Error.ThrowIfNull(source, nameof(source));
     return(source.CreateOrderedEnumerable <TKey>(keySelector, null, false));
 }
コード例 #22
0
 public IOrderedEnumerable <T> CreateOrderedEnumerable <TKey>(Func <T, TKey> keySelector, IComparer <TKey> comparer, bool descending) =>
 new WhereOrderedEnumerable <T>(source.CreateOrderedEnumerable(keySelector, comparer, descending), predicate);
コード例 #23
0
 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);
コード例 #24
0
 public IOrderedEnumerable <TSource> ThenBySample <TSource>(IOrderedEnumerable <TSource> source, Func <TSource, TKey> keySelector)
 {
     return(source.CreateOrderedEnumerable(item => this.GetOrderKey(keySelector(item)), Comparer <int> .Default, false));
 }
コード例 #25
0
 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))));
 }
コード例 #27
0
 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));
 }