C# How to start an async method without await its complete?

前端 未结 6 1433
醉酒成梦
醉酒成梦 2021-02-05 08:12

Sometimes I need to start an async job which works very slow. I don\'t care if that job success and I need to continue working on my current thread.

Like sometimes I nee

6条回答
  •  隐瞒了意图╮
    2021-02-05 08:22

    I am curious why this hasn't been suggested.

    new Thread(() =>
    {
        Thread.CurrentThread.IsBackground = true;
        //what ever code here...e.g.
        DoSomething();
        UpdateSomething();
    }).Start();  
    

    It just fires off a separate thread.

提交回复
热议问题