Created
June 19, 2014 01:58
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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