using System.Threading;
namespace ConsoleThrea
{
class Program
{
static void Main(string[] args)
{
Thread thread = new Thread(new ThreadStart(Print));
thread.Start();
Thread thread2 = new Thread(new ThreadStart(Print2));
thread2.Start();
for (int i = 0; i < 10000; i++)
{
Console.WriteLine("{0}main", i.ToString());
}
}
public static void Print()
{
for (int i = 0; i < 100; i++)
{
Console.WriteLine("{0}",i.ToString());
Thread.Sleep(10);
}
}
public static void Print2()
{
for (int i = 0; i < 100; i++)
{
Console.WriteLine("{0}---2", i.ToString());
Thread.Sleep(10);
}
}
}
}
namespace ConsoleThrea
{
class Program
{
static void Main(string[] args)
{
Thread thread = new Thread(new ThreadStart(Print));
thread.Start();
Thread thread2 = new Thread(new ThreadStart(Print2));
thread2.Start();
for (int i = 0; i < 10000; i++)
{
Console.WriteLine("{0}main", i.ToString());
}
}
public static void Print()
{
for (int i = 0; i < 100; i++)
{
Console.WriteLine("{0}",i.ToString());
Thread.Sleep(10);
}
}
public static void Print2()
{
for (int i = 0; i < 100; i++)
{
Console.WriteLine("{0}---2", i.ToString());
Thread.Sleep(10);
}
}
}
}