this.Invoke和this.BeginInvoke的区别

  private void button1_Click(object sender, EventArgs e)     
     {
      this.textBox1.Text = "1";

         this.Invoke(new EventHandler(delegate       {
            this.textBox1.Text += "2";
         }));

         this.textBox1.Text += "3";
      }

结果为:123

  private void button1_Click(object sender, EventArgs e)     
     {
      this.textBox1.Text = "1";

         this.BeginInvoke(new EventHandler(delegate       {
            this.textBox1.Text += "2";
         }));

         this.textBox1.Text += "3";
      }

结果为: 132

结论:1、Invoke会阻止当前主线程的运行;BeginInvoke不会阻止当前主线程的运行,而是等当前主线程做完事情之后再执行BeginInvoke中的代码内容。

         2、这2个方法都是由主线程运行的,并不是异步执行,如果代码耗时过长,同样会造成界面卡死

专业的介绍:http://blog.csdn.net/aptentity/article/details/5776762

原文地址:https://www.cnblogs.com/xm_cpppp/p/3543314.html