コード例 #1
0
        internal static OrderByEnumerable <TItem, TKey, TEnumerable, TEnumerator, DefaultDescending <TItem, TKey> > OrderByDescendingImpl <TItem, TKey, TEnumerable, TEnumerator>(ref TEnumerable source, Func <TItem, TKey> keySelector)
            where TEnumerable : struct, IStructEnumerable <TItem, TEnumerator>
            where TEnumerator : struct, IStructEnumerator <TItem>
        {
            var bridge = new DefaultDescending <TItem, TKey>(keySelector);

            return(new OrderByEnumerable <TItem, TKey, TEnumerable, TEnumerator, DefaultDescending <TItem, TKey> >(ref source, ref bridge));
        }
コード例 #2
0
            > ThenByDescendingImpl <TItem, TFirstKey, TComparer, TOuterEnumerable, TOuterEnumerator, TInnerEnumerable, TInnerEnumerator, TSecondKey>(
            ref TOuterEnumerable source,
            Func <TItem, TSecondKey> keySelector
            )
            where TOuterEnumerable : struct, IStructEnumerable <TItem, TOuterEnumerator>, IHasComparer <TItem, TFirstKey, TComparer, TInnerEnumerable, TInnerEnumerator>
            where TOuterEnumerator : struct, IStructEnumerator <TItem>
            where TInnerEnumerable : struct, IStructEnumerable <TItem, TInnerEnumerator>
            where TInnerEnumerator : struct, IStructEnumerator <TItem>
            where TComparer : struct, IStructComparer <TItem, TFirstKey>
        {
            var leftComparer  = source.GetComparer();
            var rightComparer = new DefaultDescending <TItem, TSecondKey>(keySelector);
            var newComparer   = new CompoundComparer <TItem, TFirstKey, TComparer, TSecondKey, DefaultDescending <TItem, TSecondKey> >(ref leftComparer, ref rightComparer);

            var inner = source.GetInnerEnumerable();

            return(new OrderByEnumerable <TItem, CompoundKey <TFirstKey, TSecondKey>, TInnerEnumerable, TInnerEnumerator, CompoundComparer <TItem, TFirstKey, TComparer, TSecondKey, DefaultDescending <TItem, TSecondKey> > >(ref inner, ref newComparer));
        }