Let's go

C#同步异步使用

1.BeginInvoke来实现异步

Action action = new Action(delegate () {
  try
  {
    //这儿执行操作
                            
  }
  catch (Exception ex)
  {
  }

  });
 action.BeginInvoke(null, null);

 

2.使用线程

HttpContext ctx = HttpContext.Current;
Thread myThread = new Thread(() =>
{
    HttpContext.Current = ctx;
    // 其他操作方法
});
myThread.Start();

 

 

  

 

3.

 

posted @ 2020-10-06 10:00  chenze  阅读(152)  评论(0编辑  收藏  举报
有事您Q我