You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Note the type of t and t2.
Task<Task> t = Task.Factory.StartNew(() => DoWorkAsync());
Task<Task> t2 = DoWorkAsync().ContinueWith((s) => DoMoreWorkAsync());
Type of issue
Other (describe below)
Description
“ 在下面的示例中,Result 属性是 C# 中的 Task<Task> 或 Visual Basic 中的 Task(Of Task(Of String))。”
对应的代码是:
// Note the type of t and t2.
Task<Task> t = Task.Factory.StartNew(() => DoWorkAsync());
Task<Task> t2 = DoWorkAsync().ContinueWith((s) => DoMoreWorkAsync());
// Outputs: System.Threading.Tasks.Task`1[System.String]
Console.WriteLine(t.Result);
Result 属性应该是是 C# 中的 Task
Page URL
https://learn.microsoft.com/zh-cn/dotnet/standard/parallel-programming/how-to-unwrap-a-nested-task
Content source URL
https://github.com/dotnet/docs/blob/main/docs/standard/parallel-programming/how-to-unwrap-a-nested-task.md
Document Version Independent Id
2d7cf09a-afc5-3149-a472-cfd3acf3c697
Article author
@IEvangelist
Metadata
Related Issues
The text was updated successfully, but these errors were encountered: