@@ -70,10 +70,10 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
70
70
```csharp
71
71
async static void SpellCheck ()
72
72
{
73
- HttpClient client = new HttpClient ();
73
+ var client = new HttpClient ();
74
74
client .DefaultRequestHeaders .Add (" Ocp-Apim-Subscription-Key" , key );
75
75
76
- HttpResponseMessage response = new HttpResponseMessage () ;
76
+ HttpResponseMessage response = null ;
77
77
// add the rest of the code snippets here (except for main())...
78
78
}
79
79
```
@@ -87,14 +87,11 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
87
87
3 . Create a list with a `KeyValuePair ` object containing your text , and use it to create a `FormUrlEncodedContent ` object . Set the header information , and use `PostAsync ()` to send the request .
88
88
89
89
```csharp
90
- List < KeyValuePair < string , string >> values = new List < KeyValuePair < string , string > >();
91
- values .Add (new KeyValuePair < string , string >( " text" , text ) );
90
+ var values = new Dictionary < string , string >();
91
+ values .Add (" text" , text );
92
92
93
- using (FormUrlEncodedContent content = new FormUrlEncodedContent (values ))
94
- {
95
- content .Headers .ContentType = new MediaTypeHeaderValue (" application/x-www-form-urlencoded" );
96
- response = await client .PostAsync (uri , content );
97
- }
93
+ content .Headers .ContentType = new MediaTypeHeaderValue (" application/x-www-form-urlencoded" );
94
+ response = await client .PostAsync (uri , new FormUrlEncodedContent (values ));
98
95
```
99
96
100
97
## Get and print the API response
0 commit comments