Should I use MethodInvoker or Action

Possible duplicate:
MethodInvoker vs Action for Control.BeginInvoke

    ThreadPool.QueueUserWorkItem(x =>
        {
            //get dataset from web service

            BeginInvoke(new Action(() => { 
                //fill grid
            }));

            BeginInvoke(new MethodInvoker(() => {
                //fill grid
            }));
        });

In C # 2.0, I used MethodInvoker highlighting to update the user interface from a background thread, would it make sense to switch to Action when used in BeginInvoke? Is it faster or safer to use an action?

+3
source share
2 answers

, , . MethodInvoker WinForms . Action .

+2

( MSDN):

public delegate void MethodInvoker()
public delegate void Action()

, IL . , . Action , MethodInvoker . , .

, , .

+1

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


All Articles