예제 #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("This example will show how to write multithreaded console.");

            var MyComputation = new LongComputation();

            StopwatchDelegate GotTime =
                e =>
            {
                Console.WriteLine("time: " + e.TotalMilliseconds + "ms");
            };

            GotTime.Measure(
                delegate
            {
                MyComputation.Start();

                Console.WriteLine();
                Console.WriteLine("Press enter to stop current computation.");
                Console.ReadLine();

                MyComputation.Stop();

                Console.WriteLine("Value: " + MyComputation.Current.Value);
            }
                );

            Console.WriteLine();
            Console.WriteLine("Press enter to exit.");
            Console.ReadLine();
        }