Sending messages between threads in C#
问题 How can I send and receive messages between threads? 回答1: One solution would be share a concurrent queue, for example (albeit its name) ConcurrentQueue. This will allow you to enqueue an object from one thread and have the other thread (or others threads) dequeue from the queue. As it is a generic solution, you may pass strongly typed items, anything from string to Action will do, or your own custom message class of course. Threre is just one limitation with this approach, the class