-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSimpleProgram.cs
More file actions
54 lines (46 loc) · 1.26 KB
/
SimpleProgram.cs
File metadata and controls
54 lines (46 loc) · 1.26 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System.Globalization;
namespace Otus.AsyncAwait
{
public class SimpleProgram
{
//Async
public void Execute1()
{
Console.WriteLine("hello");
}
public async void Execute1Async()
{
Console.WriteLine("hello");
}
//Await
public async void Execute3Async()
{
Console.WriteLine($"hello {DateTime.UtcNow}");
await Task.Delay(5000);
Console.WriteLine($"hello again {DateTime.UtcNow}");
}
public async Task<int> ExecuteAsync(int x)
{
Console.WriteLine("hello");
//return Task.FromResult(1);
//return await Task.FromResult(1);
var result = await ReturnTaskInt();
return 1;
}
private async Task<int> ReturnTaskInt()
{
return await Task.FromResult(1);
}
private async Task Method()
{
Console.WriteLine("");
//return Task.CompletedTask;
//return await Task.Delay(100);
}
private async Task<int> Method2()
{
Console.WriteLine("");
return await Task.FromResult(1);
}
}
}