-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKod31_EasyAsync.cs
More file actions
38 lines (31 loc) · 1012 Bytes
/
Copy pathKod31_EasyAsync.cs
File metadata and controls
38 lines (31 loc) · 1012 Bytes
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
using System.Diagnostics;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using static System.Net.Mime.MediaTypeNames;
using System.Threading.Tasks;
/*Задача 31:Самый простой async-метод (задержка)
Напиши метод async Task SayHelloAsync(), который:
Выводит "Привет, начинаю..."
Ждёт 2 секунды (Task.Delay)
Выводит "Готово!"
Вызови его из Main с await.*/
class Program
{
static async Task Main()
{
static async Task<string> SayHello()
{
Console.WriteLine("Привет! Начинаю...");
await Task.Delay(2000);
return "Готово!";
}
string result = await SayHello();
Console.WriteLine(result);
}
}