示例#1
0
        private static void ConcurrentDictionaryDemo()
        {
            var      controller = new StockController();
            TimeSpan workDay    = new TimeSpan(0, 0, 1);

            Task t1 = Task.Run(() => new SalesManager("Cody").StartWork(controller, workDay));
            Task t2 = Task.Run(() => new SalesManager("Connor").StartWork(controller, workDay));
            Task t3 = Task.Run(() => new SalesManager("Sean").StartWork(controller, workDay));

            Task.WaitAll(t1, t2, t3);

            controller.DisplayStatus();
        }