/// <summary>Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Double" /> value.</summary> /// <returns>The minimum value in the sequence.</returns> /// <param name="source">A sequence of values to determine the minimum value of.</param> /// <param name="selector">A transform function to apply to each element.</param> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception> /// <exception cref="T:System.InvalidOperationException"> /// <paramref name="source" /> contains no elements.</exception> public static IBindable <double> Min <TSource>(this IBindableCollection <TSource> source, Expression <Func <TSource, double> > selector) where TSource : class { return(source.Select(selector).Min()); }
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Single" /> value.</summary> /// <returns>The maximum value in the sequence.</returns> /// <param name="source">A sequence of values to determine the maximum value of.</param> /// <param name="selector">A transform function to apply to each element.</param> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception> /// <exception cref="T:System.InvalidOperationException"> /// <paramref name="source" /> contains no elements.</exception> public static IBindable <float> Max <TSource>(this IBindableCollection <TSource> source, Expression <Func <TSource, float> > selector) where TSource : class { source.ShouldNotBeNull("source"); return(source.Select(selector).Max()); }
/// <summary> /// Projects each element of a sequence into a new form. /// </summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source"/>.</typeparam> /// <param name="source">A sequence of values to invoke a transform function on.</param> /// <param name="dependencyAnalysisMode">The dependency analysis mode.</param> /// <returns> /// An <see cref="IBindableCollection{TElement}"/> whose elements are the result of invoking the transform function on each element of <paramref name="source"/>. /// </returns> /// <exception cref="T:System.ArgumentNullException"><paramref name="source"/> is null.</exception> public static IBindableCollection <TSource> Select <TSource>(this IBindableCollection <TSource> source, DependencyDiscovery dependencyAnalysisMode) where TSource : class { return(source.Select(s => s, dependencyAnalysisMode)); }
/// <summary>Computes the sum of the sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary> /// <returns>The sum of the projected values.</returns> /// <param name="source">A sequence of values that are used to calculate a sum.</param> /// <param name="selector">A transform function to apply to each element.</param> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception> public static IBindable <float> Sum <TSource>(this IBindableCollection <TSource> source, Expression <Func <TSource, float> > selector) where TSource : class { return(source.Select(selector).Sum()); }