Пример #1
0
        static void Main(string[] args)
        {
            StopWatch instance = new StopWatch();

            instance.Start();
            Console.ReadLine();
            Thread.Sleep(5000);
            instance.Stop();
            Console.WriteLine("Interval =" + instance.GetInterval());
            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            var stopwatch = new StopWatch();

            for (int i = 0; i < 2; i++)
            {
                stopwatch.Start();
                Thread.Sleep(1000);
                stopwatch.Stop();
                Console.WriteLine("Duration: " + stopwatch.GetInterval());
                Console.WriteLine("Press Enter to start Stopwatch one more time");
                Console.ReadLine();
            }
        }