C#.Rihter.Timer

simple example, task will be created periodically and will be handled in thread pool with Thread.QueueUserWorkItem

            var timer = new Timer(
                (o) => { Console.WriteLine("hi");},
                null,
                0,
                1000
                );

            timer.Change(2000, 5000); // will change due time and period      
            Thread.Sleep(3000);

output

hi
hi
hi
This entry was posted in Без рубрики. Bookmark the permalink.