Advertisement
Guest User

Untitled

a guest
May 6th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4.  
  5. namespace ConsoleApplication2
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. wyswietlCzas();
  12. Console.ReadLine();
  13. }
  14. static async void wyswietlCzas() //pobranie w osobnym wątku co 5 sek.
  15. {
  16. while (true)
  17. {
  18. await Task.Factory.StartNew(() =>
  19. {
  20. Thread.Sleep(5000);
  21. Console.WriteLine(DateTime.Now);
  22. });
  23. }
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement