Registration of an event from another topic

I have a question about events in C #. Suppose I have an object obj1 of a class that provides an event, and this object runs on thread t1. Now in another thread t2 there is another object named obj2 registered for the event obj1.

Is obj2 expected to receive an event when it is raised? thank.

+3
source share
1 answer

Yes. However, the event will be raised (which means that the event handler will be fired) in the method thread that raises it. In your case, it will be raised to t1.

"obj2" , t2, . , , , "obj2" .

+3

Source: https://habr.com/ru/post/1739542/


All Articles