C# Call a method in a new thread

后端 未结 6 1286
甜味超标
甜味超标 2020-12-13 04:08

I am looking for a way to call a method on a new thread (using C#).

For instance, I would like to call SecondFoo() on a new thread. However, I would the

6条回答
  •  心在旅途
    2020-12-13 04:26

    Does it really have to be a thread, or can it be a task too?

    if so, the easiest way is:

    Task.Factory.StartNew(() => SecondFoo())
    

提交回复
热议问题