IntelliTect / IntelliTect/CodingGuidelines

Flag Task.Delay(0) as being Task.CompletedTask

未關閉
#55 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement Hacktoberfest
主要語言
C#
星號
12
分支
16
平均合併
2 分鐘
30 天內合併 PR
7

描述

Task.Delay(0) is the same as Task.CompletedTask
[.NET Core](https://source.dot.net/#System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs,5396)
[.NET Framework](https://referencesource.microsoft.com/#mscorlib/system/threading/Tasks/Task.cs,5881)

Test cases:
```
Task.Delay(0);
Task.Delay(0, token);
```

Suggest:
We should suggest changing to `Task.CompletedTask` since that is what is going to happen anyway.

貢獻指南

開啟貢獻指南

研究方向

Read the linked .NET Core and .NET Framework Task implementations, then use the two listed Task.Delay cases as the behavior to verify. Locate the repository's diagnostic entry point and ensure both cases are flagged with a suggestion to use Task.CompletedTask; done means the diagnostics and their tests cover both forms.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp
領域
tooling
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。