コード例 #1
0
        /// <summary>
        /// Return time lead of method <see cref="Task2.FindNextBiggerNumber(int)"/>.
        /// </summary>
        /// <param name="initialNumber">Number.</param>
        /// <returns>The object of type Stopwatch.</returns>
        public static Stopwatch GetLeadTimeFindNextBiggerNumber(int initialNumber)
        {
            Stopwatch timer = new Stopwatch();

            timer.Start();
            Task2.FindNextBiggerNumber(initialNumber);
            timer.Stop();
            return(timer);
        }
コード例 #2
0
        /// <summary>
        /// Add to the FindNextBiggerNumber method the ability to return the time
        /// of finding a given number by considering various language features.
        /// </summary>
        /// <param name="number">Input value</param>
        /// <returns>Time test</returns>
        public static Stopwatch TimeFindNumber(int number)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            Task2.FindNextBiggerNumber(number);

            stopwatch.Stop();

            return(stopwatch);
        }