dotnet / dotnet/dotnet-api-docs

Simplify example to use async main and Task.Delay

Open
#945 1 comment 0 reactions 0 assignees View on GitHub
area-System.Threading.Tasks dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

As of C# 7.1 you could mark main async and simplify the example to remove Task.Run and extra async delegate, to focus in on Task.Delay and how it works. I would consider refactoring the example.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 6ec08720-a8de-c325-20d4-7735044afa5a
* Version Independent ID: e3828f5f-0390-8640-3e1d-518b1f08145a
* Content: [Task.Delay Method (System.Threading.Tasks)](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task.delay?view=netcore-2.1#System_Threading_Tasks_Task_Delay_System_Int32_System_Threading_CancellationToken_)
* Content Source: [xml/System.Threading.Tasks/Task.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Threading.Tasks/Task.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.