-
Notifications
You must be signed in to change notification settings - Fork 0
/
线程sleep.cs
40 lines (32 loc) · 1022 Bytes
/
线程sleep.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello world. Let's do this.");
// DateTime dt1 = DateTime.Now;
// Thread.Sleep(10000);
// DateTime dt2 = DateTime.Now;
for (int i = 0; i < 5; i++)
{
DateTime dt = DateTime.Now;
timeboard.Add(i, dt);
Thread.Sleep(1000);
}
for (int j = 0; j < timeboard.Count(); j++)
{
DateTime dt2 = DateTime.Now;
Console.WriteLine((dt2 - timeboard[j]).ToString());
}
Console.ReadLine();
}
static private Dictionary<int, DateTime> timeboard = new Dictionary<int, DateTime>();
}
}