Control.Invoke () vs Control.BeginInvoke ()

Possible duplicate:
What is the difference between Invoke () and BeginInvoke ()

First of all, I would like to apologize for my poor grammar, since English is not my native language.

This is my understanding:

Control.Invoke(delegated_method) // Executes on the thread wich the control was created on witch holds its handle ,typically this would be the main thread of a winform application . Control.BeginInvoke(delegated_method // Executes asynchronously on a threadPool Thread . 

According to MSDN, it says

Performs an asynchronous delegate translation of the thread that controls the underlying descriptor has been created.

My question is:

I should understand that beginInvoke considers the main thread in this question, since it will be a thread pool and execute the delegated method in the main thread when it "gets a chance"?

Another question that raises is, is it possible to create a control that is not in the main thread? If anyone could give me an example?

+4
source share
1 answer

Yes, it will be executed on the thread manager of the user interface that created it.

As for creating a control in the background thread, I would not recommend it. In addition, you did not indicate which technology you are working with.

+1
source

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


All Articles