Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- namespace Articulos.Cap04
- {
- public sealed class MetodoAnonimoDelegadoThreadStart
- {
- public static void Main()
- {
- Thread thread = new Thread (
- delegate()
- {
- for (int i = 0; i < 5; ++i)
- {
- Console.WriteLine (i.ToString());
- // Pausa este thread por 0.5s:
- Thread.Sleep (500);
- }
- }
- );
- // Inicia la ejecución del Thread:
- thread.Start();
- Console.WriteLine ("El método Main ha finalizado su ejecución.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement