Пример #1
0
        static void Main()
        {
            Action<int> generateRandomLetterOrChar = GenerateRandomLetter;

            const string message =
                "I'm running independly of the timer, so I show up before the timer is up. Anyway here's 111 random characters:";

            var timer = new AsyncTimer(generateRandomLetterOrChar, message.Length, 70);
            timer.Run();

            Console.WriteLine(message);
        }
Пример #2
0
        static void Main(string[] args)
        {
            Action action = new Action(PrintSomething);
            AsyncTimer t = new AsyncTimer(action, 5, 1000);

            t.Run();

            string msg = Console.ReadLine();

            while (!msg.ToLower().Equals("quit") && !msg.ToLower().Equals("exit"))
            {
                msg = Console.ReadLine();
            }

            t.thread.Join();
        }