#MultiThreader in cs

2 messages · Page 1 of 1 (latest)

pliant inlet
#

Here ```cs
using System;
using System.Threading;

class Program
{
static void Main(string[] args)
{
Thread[] threads = new Thread[10000];

    for(int i = 0; i < threads.Length; i++)
    {
        try
        {
            threads[i] = new Thread(() =>
            {
                Console.WriteLine($"Thread {Thread.CurrentThread.ManagedThreadId} : {i}");
            });
        }

        catch(OutOfMemoryException ex)
        {
            Console.WriteLine($"Out Of Usable Memory {ex}");
        }
    }

    foreach(Thread thread in threads)
    {
        thread.Start();
    }
}

}```

fathom ridge
#

10,000 threads