static void Main(string[] args) { Termelo t1 = new Termelo(3, 200); Termelo t2 = new Termelo(5, 100); Termelo t3 = new Termelo(7, 100); Thread szal1 = new Thread(t1.Termel); Thread szal2 = new Thread(t2.Termel); Thread szal3 = new Thread(t3.Termel); szal1.Start(); szal2.Start(); szal3.Start(); Fogyaszto f1 = new Fogyaszto(ConsoleColor.Red); Fogyaszto f2 = new Fogyaszto(ConsoleColor.Yellow); Fogyaszto f3 = new Fogyaszto(ConsoleColor.Green); Thread szal4 = new Thread(f1.Fogyaszt); Thread szal5 = new Thread(f2.Fogyaszt); Thread szal6 = new Thread(f3.Fogyaszt); szal4.Start(); szal5.Start(); szal6.Start(); szal4.Join(); szal5.Join(); szal6.Join(); //Console.ReadLine(); Console.WriteLine("A kapott ellenállások: "); for (int i = 0; i < anyagok.Count; i++) { Console.Write("{0}, ", anyagok[i].ToString()); } Console.WriteLine("\n{0}",anyagok.Count); Console.ReadLine(); }
static void Main(string[] args) { Termelo T1 = new Termelo(0, 100); Termelo T2 = new Termelo(100, 200); Fogyaszto F1 = new Fogyaszto(); Fogyaszto F2 = new Fogyaszto(); Thread t1 = new Thread(T1.Termel); Thread t2 = new Thread(T2.Termel); Thread t3 = new Thread(F1.Fogyaszt); Thread t4 = new Thread(F2.Fogyaszt); t1.Start(); t2.Start(); t3.Start(); t4.Start(); t3.Join(); t4.Join(); Console.WriteLine(Szamok.list.Count); Console.ReadKey(); }