That is what Task.Run does:
Task.Run Method (System.Threading.Tasks) | Microsoft Docs[
^]
For example:
using System;
using System.Threading.Tasks;
using System.Threading;
public class Program
{
public static void Main()
{
Console.WriteLine("Hello World");
Task.Run(() => Foo("bar"));
Console.WriteLine("After");
Thread.Sleep(500);
Console.WriteLine("Done");
}
static void Foo(string s)
{
Thread.Sleep(200);
Console.WriteLine(s);
}
}
Will give you:
Hello World
After
bar
Done