什么是调用?

BOS*_*OSS 11 c# invoke visual-studio

什么是方法调用,control.invoke?

在编程中一般调用什么

例子 :

MethodInvoker getValues = new MethodInvoker(delegate()
{
    checkbox1Checked = checkbox1.Checked;
    textBox6Text = textBox6.Text;
    textBox7Text = textBox7.Text;
    textBox3Text = textBox3.Text;
    textBox1Text = textBox1.Text;
    textBox4Text = textBox4.Text;
    richTextBox1Text = richTextBox1.Text;
    textBox5Text = textBox5.Text;
});

if (this.InvokeRequired)
{
    this.Invoke(getValues);
}
else
{
    getValues();
}
Run Code Online (Sandbox Code Playgroud)

而且我也想知道MethodInvoker和InvokeRequired是什么意思?

Dro*_*per 12

"调用"是指调用方法.

在winforms Control.Invoke中用于调用UI线程上的方法 - 没有它,您可以通过从另一个线程更新UI来导致异常.

因此,如果InvokeRequires返回true则意味着您没有在UI线程中运行,并且应该使用Control.Invoke在正确的线程中运行调用.