Cita:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ConsoleApplication1
{
class hi2
{
public void mostrar1()
{
for (int i = 0; i < 5; i++)
Console.WriteLine("escribiendo -> 1");
Thread.Sleep(1000);
}
public void mostrar2()
{
for (int i = 0; i < 5; i++)
Console.WriteLine("escribiendo -> 2");
Thread.Sleep(1000);
}
}
class Program
{
static void Main(string[] args)
{
hi2 hilo = new hi2();
Thread h1 = new Thread(hilo.mostrar1);
Thread h2 = new Thread(hilo.mostrar2);
h1.Start();
h2.Start();
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ConsoleApplication1
{
class hi2
{
public void mostrar1()
{
for (int i = 0; i < 5; i++)
Console.WriteLine("escribiendo -> 1");
Thread.Sleep(1000);
}
public void mostrar2()
{
for (int i = 0; i < 5; i++)
Console.WriteLine("escribiendo -> 2");
Thread.Sleep(1000);
}
}
class Program
{
static void Main(string[] args)
{
hi2 hilo = new hi2();
Thread h1 = new Thread(hilo.mostrar1);
Thread h2 = new Thread(hilo.mostrar2);
h1.Start();
h2.Start();
Console.ReadKey();
}
}
}