Пример #1
0
        /// <summary>
        /// Orders the ordered observable by a further sorting criterion descendingly.
        /// </summary>
        /// <typeparam name="T">The element type of the source and result observables.</typeparam>
        /// <typeparam name="TSelect">The type of the selected sorting criterion.</typeparam>
        /// <param name="source">The observable to sort.</param>
        /// <param name="selector">The selector to select the sorting criterion.</param>
        /// <param name="comparer">The comparer to compare the sorting criterion.</param>
        /// <returns>The new observable instance.</returns>
        public static IOrderedAsyncObservable <T> ThenByDescending <T, TSelect>(this IOrderedAsyncObservable <T> source, Func <T, TSelect> selector, IComparer <TSelect> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            return(source.CreateOrderedObservable(selector, comparer, true));
        }
Пример #2
0
        /// <summary>
        /// Orders the ordered observable by a further sorting criterion ascendingly.
        /// </summary>
        /// <typeparam name="T">The element type of the source and result observables.</typeparam>
        /// <typeparam name="TSelect">The type of the selected sorting criterion.</typeparam>
        /// <param name="source">The observable to sort.</param>
        /// <param name="selector">The selector to select the sorting criterion.</param>
        /// <returns>The new observable instance.</returns>
        public static IOrderedAsyncObservable <T> ThenBy <T, TSelect>(this IOrderedAsyncObservable <T> source, Func <T, TSelect> selector)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            return(source.CreateOrderedObservable(selector, null, false));
        }