예제 #1
0
        /// <summary>
        /// Wraps the provided delegate into a <see cref="DelegateInvocationCounter{T}"/>.
        /// </summary>
        /// <param name="delegate"></param>
        /// <returns></returns>
        public static DelegateInvocationCounter <Action <T1, T2, T3> > TrackInvocationCount <T1, T2, T3> (Action <T1, T2, T3> @delegate)
        {
            var counter = new DelegateInvocationCounter <Action <T1, T2, T3> > ( );

            counter.WrappedDelegate = (arg1, arg2, arg3) =>
            {
                counter.Increment( );
                @delegate(arg1, arg2, arg3);
            };
            return(counter);
        }
예제 #2
0
        /// <summary>
        /// Wraps the provided delegate into a <see cref="DelegateInvocationCounter{T}"/>.
        /// </summary>
        /// <param name="delegate"></param>
        /// <returns></returns>
        public static DelegateInvocationCounter <Func <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TReturn> > TrackInvocationCount <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TReturn> (Func <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TReturn> @delegate)
        {
            var counter = new DelegateInvocationCounter <Func <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TReturn> > ( );

            counter.WrappedDelegate = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16) =>
            {
                counter.Increment( );
                return(@delegate(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16));
            };
            return(counter);
        }
예제 #3
0
        /// <summary>
        /// Wraps the provided delegate into a <see cref="DelegateInvocationCounter{T}"/>.
        /// </summary>
        /// <param name="delegate"></param>
        /// <returns></returns>
        public static DelegateInvocationCounter <Func <T1, T2, T3, T4, T5, T6, T7, TReturn> > TrackInvocationCount <T1, T2, T3, T4, T5, T6, T7, TReturn> (Func <T1, T2, T3, T4, T5, T6, T7, TReturn> @delegate)
        {
            var counter = new DelegateInvocationCounter <Func <T1, T2, T3, T4, T5, T6, T7, TReturn> > ( );

            counter.WrappedDelegate = (arg1, arg2, arg3, arg4, arg5, arg6, arg7) =>
            {
                counter.Increment( );
                return(@delegate(arg1, arg2, arg3, arg4, arg5, arg6, arg7));
            };
            return(counter);
        }
예제 #4
0
        /// <summary>
        /// Wraps the provided delegate into a <see cref="DelegateInvocationCounter{T}"/>.
        /// </summary>
        /// <param name="delegate"></param>
        /// <returns></returns>
        public static DelegateInvocationCounter <Func <T1, T2, TReturn> > TrackInvocationCount <T1, T2, TReturn> (Func <T1, T2, TReturn> @delegate)
        {
            var counter = new DelegateInvocationCounter <Func <T1, T2, TReturn> > ( );

            counter.WrappedDelegate = (arg1, arg2) =>
            {
                counter.Increment( );
                return(@delegate(arg1, arg2));
            };
            return(counter);
        }
예제 #5
0
        /// <summary>
        /// Wraps the provided delegate into a <see cref="DelegateInvocationCounter{T}"/>.
        /// </summary>
        /// <param name="delegate"></param>
        /// <returns></returns>
        public static DelegateInvocationCounter <Action> TrackInvocationCount(Action @delegate)
        {
            var counter = new DelegateInvocationCounter <Action> ( );

            counter.WrappedDelegate = () =>
            {
                counter.Increment( );
                @delegate( );
            };
            return(counter);
        }
예제 #6
0
        /// <summary>
        /// Wraps the provided delegate into a <see cref="DelegateInvocationCounter{T}"/>.
        /// </summary>
        /// <param name="delegate"></param>
        /// <returns></returns>
        public static DelegateInvocationCounter <Action <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> > TrackInvocationCount <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> (Action <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> @delegate)
        {
            var counter = new DelegateInvocationCounter <Action <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> > ( );

            counter.WrappedDelegate = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) =>
            {
                counter.Increment( );
                @delegate(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14);
            };
            return(counter);
        }