Advertisement
Fhernd

ImpresionNumeros.cs

Sep 18th, 2014
781
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace Recetas.Multithreading.Cap01
  5. {
  6.     public sealed class ImpresionNumeros
  7.     {
  8.         public static void Main()
  9.         {
  10.             Thread nuevoThread = new Thread (new ThreadStart (ImprimirNumeros));
  11.             nuevoThread.Start();
  12.            
  13.             ImprimirNumeros();
  14.         }
  15.        
  16.         // Método que se invocará por el thrad de Main, y
  17.         // el nuevo que creamos dentro ese mismo método:
  18.         public static void ImprimirNumeros()
  19.         {
  20.             Console.WriteLine ("Iniciando ejecución...");
  21.            
  22.             for (int i = 1; i < 10; ++i)
  23.             {
  24.                 Console.WriteLine (i.ToString());
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement