Пример #1
0
        public void Buy(string productName, PaySystem paySystem, PostSystem postSystem)
        {
            Thread payment       = new Thread(paySystem.Pay);
            Thread parcelSending = new Thread(postSystem.SendParcel);

            payment.Start();
            payment.Join();
            parcelSending.Start();
            parcelSending.Join();
            Console.WriteLine("{0} was bought", productName);
        }
        public void Buy(Shop shop, string productName, PaySystem paySystem, PostSystem postSystem)
        {
            Thread buyThread = new Thread(() => shop.Buy(productName, paySystem, postSystem));

            buyThread.Start();
        }