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
> Continued tasks created by `ContinueWith` cannot `Start()`
41
40
42
41
### Create Task with Return
43
42
44
-
Generictaskscomeintoplaywhenprovideddelegate would return a result.
43
+
Generic tasks come into play when provided with delegate would return a result.
45
44
The type parameter is exactly the type of return.
46
45
47
46
```cs
@@ -51,7 +50,8 @@ task.Start();
51
50
52
51
### Create with Argument
53
52
54
-
Both `TaskFactory` and `Task` supports an overload to accept **single argument** when the signature contains a parameter
53
+
Both `TaskFactory` and `Task` supports an overload to accept **single argument** when the signature contains a parameter.
54
+
55
55
Since only single value is supported, you may need an abstraction when to pass multiple values
56
56
57
57
```cs
@@ -67,6 +67,9 @@ task.Start();
67
67
> [!NOTE]
68
68
> `Task.Run` does not support overloads accept an argument
69
69
70
+
> [!TIP]
71
+
> One should prefer creating tasks supports arguments using `async` delegate unless you don't want it to begin immediately.
72
+
70
73
### Create from Async Delegate
71
74
72
75
`async` is a syntax sugar for creating task from a lambda or `async` method.
@@ -106,6 +109,7 @@ If one need to start a `async` delegate directly using `TaskFactory.StartNew`, `
106
109
That is because, `async` delegate is a factory for dedicated task, so the result for starting the delegate directly would be a task created from the delegate instead of the expected result.
0 commit comments