Skip to content

Instantly share code, notes, and snippets.

@fabio-stein
fabio-stein / SimpleParallelTaskExample.cs
Created September 8, 2021 23:50
Example - Run Tasks in parallel with PLINQ controlling/limiting max number of threads
using System;
using System.Linq;
using System.Threading.Tasks;
class Program
{
const int generatedTasks = 10;
const int maxThreads = 2;
static Random random = new Random();