C# 类中如何使用BeginInvoke,我在使用为什么提示未定义啊,using System.Windows.Forms;也不行啊

解决方案 »

  1.   

    NewDelegate task = newTask;
    IAsyncResult asyncResult = task.BeginInvoke(2000, null, null);
      

  2.   

    private delegate void BeginInvokeDelegate();
    private void BeginInvokeMethod(){
       //C代码段
    }
    private void butBeginInvoke_Click(object sender, EventArgs e) {
       //A代码段.......
       this.BeginInvoke(new BeginInvokeDelegate(BeginInvokeMethod));
       //B代码段......
    }
      

  3.   

    楼主要用异步??直接Inovke不可以吗??
      

  4.   

    BeginInvoke是某些类的一个方法,不是所有对象都可以调用的。
      

  5.   

    即使同步,在一个单元类中,也提示当前上下文中不存在“Inovke”名称