Answer the question
In order to leave comments, you need to log in
How to run a method in multithread?
Hello. How to run a method in multithread?
public async Task Run()
{
if (!GetData())
{
//уведомление
return;
}
if (!await OkLion())
{
//уведомление
return;
}
await GoVelo();
SaveHuman();
}
var tasks = Enumerable.Range(1, 10)
.Select((x) =>
{
Bego bego = new Bego();
return bego.Run();
})
.ToArray();
await Task.WhenAll(tasks);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question