KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm wondering what is the best way to implement communication between two threads. I have one thread that generates random number(class Sender) and now I want to have another thread(class Receiver) that 'll receive generated random number. This is Sender: public class Sender { public int GenerateNumber(){ //some code return randomNumber; } } Afcourse in Main function I'll start those threads: static void Main(string[] args){ Sender _sender=new Sender(); Thread thread1=new Thread(new ThreadStart(_sender.GenerateNumber)); } I appreciate your help
Tags (comma-separated)
Save Edits
Cancel