问题描述

有这样一段测试代码

string[] args)
   2:  {
   3:      Action funcDelegate = TestFunc;
   4:      funcDelegate.BeginInvoke(Done, funcDelegate);
   5:      Console.ReadKey();
   6:  }
   7:  
void Done(IAsyncResult ar)
   9:  {
try
  11:      {
  12:          var funcDelegate =  (Action)ar.AsyncState;
  13:          funcDelegate.EndInvoke(ar);
catch(Exception e)
  15:      {
,e.Message);
  17:      }
  18:  }
  19:  
void TestFunc()
  21:  {
  22:      Thread.Sleep(2000);
);
  24:  }

相关文章: