Skip to content

Commit 748c272

Browse files
pkulikovBillWagner
authored andcommitted
Add missing async modifiers (#16760)
1 parent 3af0ffc commit 748c272

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/csharp/tutorials/console-webapiclient.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ as you fill in the method.
110110
Next, rename the namespace defined in the `namespace` statement from its default of `ConsoleApp` to `WebAPIClient`. We'll later define a `repo` class in this namespace.
111111

112112
Next, update the `Main` method to call this method. The
113-
`ProcessRepositories` method returns a Task, and you shouldn't exit the
114-
program before that task finishes. Therefore, you must change the signature of `Main`. Add the `async` modifier, and change the return type to `Task`. Then, in the body of the method, add a call to `ProcessRepositories`. Add the `await` keyword when to that method call:
113+
`ProcessRepositories` method returns a task, and you shouldn't exit the
114+
program before that task finishes. Therefore, you must change the signature of `Main`. Add the `async` modifier, and change the return type to `Task`. Then, in the body of the method, add a call to `ProcessRepositories`. Add the `await` keyword to that method call:
115115

116116
```csharp
117-
static Task Main(string[] args)
117+
static async Task Main(string[] args)
118118
{
119119
await ProcessRepositories();
120120
}
@@ -123,7 +123,7 @@ static Task Main(string[] args)
123123
Now, you have a program that does nothing, but does it asynchronously. Let's improve it.
124124

125125
First you need an object that is capable to retrieve data from the web; you can use
126-
a <xref:System.Net.Http.HttpClient> to do that. This object handles the request and the responses. Instantiate a single instance of that type in the `Program` class inside the Program.cs file.
126+
a <xref:System.Net.Http.HttpClient> to do that. This object handles the request and the responses. Instantiate a single instance of that type in the `Program` class inside the *Program.cs* file.
127127

128128
```csharp
129129
namespace WebAPIClient
@@ -132,7 +132,7 @@ namespace WebAPIClient
132132
{
133133
private static readonly HttpClient client = new HttpClient();
134134

135-
static Task Main(string[] args)
135+
static async Task Main(string[] args)
136136
{
137137
//...
138138
}
@@ -299,7 +299,7 @@ Then, let's modify the `Main` method so that it captures those results and write
299299
to the console. Your `Main` method now looks like this:
300300

301301
```csharp
302-
public static Task Main(string[] args)
302+
public static async Task Main(string[] args)
303303
{
304304
var repositories = await ProcessRepositories();
305305

0 commit comments

Comments
 (0)