Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created June 19, 2014 01:58
Show Gist options
  • Save Fhernd/824cedd64608ece1b497 to your computer and use it in GitHub Desktop.
Save Fhernd/824cedd64608ece1b497 to your computer and use it in GitHub Desktop.
Uso básico del método Sleep(int) para pausar el thread principal durante 2 segundos.
using System;
using System.Threading;
namespace Recetas.Multithreading.Cap01
{
public sealed class UsoSleep
{
public static void Main()
{
for (int i = 1; i <= 5; ++i)
{
Console.WriteLine ("Pausa por 2 segundos...");
// Detiene el thread por 2 segundos:
Thread.Sleep (2000); // Alternativo Thread.Sleep (TimeSpan.FromSeconds(2));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment