You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mchsamples-.net-core/p09_Concurrency_Asynchrony/ex_050_011_ThreadPool/Program.cs

21 lines
512 B

using System;
using System.Threading;
using System.Threading.Tasks;
namespace ex_050_011_ThreadPool
{
class Program
{
static void Main(string[] args)
{
//méthode avec le framework 4.0
ThreadPool.QueueUserWorkItem(rien => Console.WriteLine("coucou"));
//conseillée depuis le framework 4.0 (les tasks sont par défaut sur le thread pool)
Task.Run(() => Console.WriteLine("coucou2"));
Thread.Sleep(1000);
}
}
}