All pastes #163315 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-09-07 12:28 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            MyThreadTest m1 = new MyThreadTest();
            Thread t1 = new Thread(new ThreadStart(m1.ShowSomething));
            t1.Name = "t1";

            Console.WriteLine("Starting threads");

            t1.Start();

            Console.WriteLine("Threads started");

        }
    }
    public class MyThreadTest
    {
        public int sleepTime;
        public static Random r = new Random();

        public void MessagePrinter()
        {
            sleepTime = r.Next(10000000);
        }
        public MyThreadTest()
        {
        }
        public void ShowSomething()
        {
            Console.WriteLine("Hi");
            Thread.Sleep(sleepTime);
            Console.WriteLine("Hi again");
        }
    }
}