Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
634 B
0
Indexable
Never
using System;
using System.Threading;

class Program
{
    static void Main(string[] args)
    {
        Thread t1 = new Thread(() =>
        {
            for (int i = 1; i <= 5; i++)
            {
                Console.WriteLine("Thread 1: " + i);
                Thread.Sleep(1000);
            }
        });
        Thread t2 = new Thread(() =>
        {
            for (int i = 1; i <= 5; i++)
            {
                Console.WriteLine("Thread 2: " + i);
                Thread.Sleep(1000);
            }
        });
        t1.Start();
        t2.Start();
        Console.ReadKey();
    }
}