Advertisement
svetoslavbozov

[OOP] - Extension Methods and LINQ - Задача 7

Mar 1st, 2013
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3.  
  4. public delegate void Timer(int seconds);
  5.  
  6. class LoopInInterval
  7. {
  8.     static void Main()
  9.     {
  10.         Timer t = new Timer(SayHi);
  11.         t(30);
  12.     }
  13.     public static void SayHi(int seconds)
  14.     {
  15.         Stopwatch watch = new Stopwatch();
  16.         watch.Start();
  17.         while (true)
  18.         {
  19.             if (watch.Elapsed.TotalSeconds % seconds == 0)
  20.             {
  21.                 Console.WriteLine("Hi");
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement