static void Main(string[] args) { Scheduler scehduler = new Scheduler(); scehduler.Add(async() => { await Task.Delay(1000); Console.WriteLine("AAAAAAAA"); }); scehduler.Run(); System.Threading.Thread.Sleep(1100); scehduler.Run(); Console.ReadLine(); ScriptSystem tmp = new ScriptSystem(0); var a1 = new Test2() { Name = "1", Priority = 2, testcab = test }; var a2 = new Test2() { Name = "2", Priority = 1, testcab = test }; var a3 = new Test() { Name = "3", Priority = 0, testcab = test }; var a4 = new Test3() { Name = "4", Priority = 0, testcab = test }; tmp.Add(a1); tmp.Add(a2); tmp.Add(a3); tmp.Add(a4); tmp.Start(); Console.ReadLine(); tmp.Stop(); Console.ReadLine(); tmp.Start(); Console.ReadLine(); tmp.Remove(a1); tmp.Remove(a2); tmp.Remove(a3); tmp.Remove(a4); Console.ReadLine(); }