المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Threads an Objects



C# Programming
09-16-2009, 12:24 PM
I see in near every example using threads that the method to execute in the starting of the threads belong to a different class

example: ThreadStart TH = new ThreadStart(Animal1.CuentaAnimales);
Thread Thread1 = new Thread(TH);

And it suggest to me some questions, please tell me if i´m correct or not.

1) Every Thread must include it´s own data an methods so it creates an object for keeping all the code isolates in it´s own space.

2) One Tread cann´t use methods or data created in other Threads.

3) How can I Share one object like a List or Dictionary between different threads.

Best Regards