Ejemplo n.º 1
0
        /// <typeparam name="T">
        ///   The first value type.
        /// </typeparam>
        /// <typeparam name="TResult">
        ///   The return value type.
        /// </typeparam>
        /// <param name="self">
        ///   A <see cref="T:Cadenza.Tuple{T}" /> to aggregate the values of.
        /// </param>
        /// <param name="func">
        ///   A <see cref="T:System.Func{T,TResult}" /> which will be invoked, providing the values
        ///   <see cref="P:Cadenza.Tuple`1.Item1"/>
        ///   to <paramref name="func"/> and
        ///   returning the value returned by <paramref name="func"/>.
        /// </param>
        /// <summary>
        ///   Converts the <see cref="T:Cadenza.Tuple{T}" /> into a <typeparamref name="TResult"/>.
        /// </summary>
        /// <returns>
        ///   The <typeparamref name="TResult"/> returned by <paramref name="func"/>.
        /// </returns>
        /// <remarks>
        ///   <para>
        ///    <block subset="none" type="behaviors">
        ///     Passes the values <see cref="P:Cadenza.Tuple`1.Item1"/> to
        ///     <paramref name="func"/>, returning the value produced by
        ///     <paramref name="func"/>.
        ///    </block>
        ///   </para>
        /// </remarks>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <para>
        ///     <paramref name="self" /> is <see langword="null" />.
        ///   </para>
        ///   <para>-or-</para>
        ///   <para>
        ///     <paramref name="func" /> is <see langword="null" />.
        ///   </para>
        /// </exception>
        public static TResult Aggregate <T, TResult>(this Tuple <T> self, System.Func <T, TResult> func)


        {
            Check.Self(self);
            Check.Func(func);
            return(func(self.Item1));
        }
Ejemplo n.º 2
0
        /// <typeparam name="T1">
        ///   The first value type.
        /// </typeparam>
        /// <typeparam name="T2">
        ///   The second value type.
        /// </typeparam>
        /// <typeparam name="T3">
        ///   The third value type.
        /// </typeparam>
        /// <typeparam name="T4">
        ///   The fourth value type.
        /// </typeparam>
        /// <typeparam name="TResult">
        ///   The return value type.
        /// </typeparam>
        /// <param name="self">
        ///   A <see cref="T:Cadenza.Tuple{T1,T2,T3,T4}" /> to aggregate the values of.
        /// </param>
        /// <param name="func">
        ///   A <see cref="T:System.Func{T1,T2,T3,T4,TResult}" /> which will be invoked, providing the values
        ///   <see cref="P:Cadenza.Tuple`4.Item1"/>, <see cref="P:Cadenza.Tuple`4.Item2"/>, <see cref="P:Cadenza.Tuple`4.Item3"/>, <see cref="P:Cadenza.Tuple`4.Item4"/>
        ///   to <paramref name="func"/> and
        ///   returning the value returned by <paramref name="func"/>.
        /// </param>
        /// <summary>
        ///   Converts the <see cref="T:Cadenza.Tuple{T1,T2,T3,T4}" /> into a <typeparamref name="TResult"/>.
        /// </summary>
        /// <returns>
        ///   The <typeparamref name="TResult"/> returned by <paramref name="func"/>.
        /// </returns>
        /// <remarks>
        ///   <para>
        ///    <block subset="none" type="behaviors">
        ///     Passes the values <see cref="P:Cadenza.Tuple`4.Item1"/>, <see cref="P:Cadenza.Tuple`4.Item2"/>, <see cref="P:Cadenza.Tuple`4.Item3"/>, <see cref="P:Cadenza.Tuple`4.Item4"/> to
        ///     <paramref name="func"/>, returning the value produced by
        ///     <paramref name="func"/>.
        ///    </block>
        ///   </para>
        /// </remarks>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <para>
        ///     <paramref name="self" /> is <see langword="null" />.
        ///   </para>
        ///   <para>-or-</para>
        ///   <para>
        ///     <paramref name="func" /> is <see langword="null" />.
        ///   </para>
        /// </exception>
        public static TResult Aggregate <T1, T2, T3, T4, TResult>(this Tuple <T1, T2, T3, T4> self, System.Func <T1, T2, T3, T4, TResult> func)



        {
            Check.Self(self);
            Check.Func(func);
            return(func(self.Item1, self.Item2, self.Item3, self.Item4));
        }