Skip to content

Commit aa1390a

Browse files
HoundTheRon Petrusha
authored andcommitted
Added example for setting HttpClient.Timeout Property (#2367)
* Added example for setting HttpClient.Timeout Property * Added example of setting HttpClient.Timeout property * Update xml/System.Net.Http/HttpClient.xml Co-Authored-By: Ron Petrusha <[email protected]> * Update xml/System.Net.Http/HttpClient.xml Co-Authored-By: Ron Petrusha <[email protected]> * Applied suggestions
1 parent 8c56ad3 commit aa1390a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

xml/System.Net.Http/HttpClient.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,6 +2174,15 @@ public class GoodController : ApiController
21742174
21752175
The same timeout will apply for all requests using this <xref:System.Net.Http.HttpClient> instance. You may also set different timeouts for individual requests using a <xref:System.Threading.CancellationTokenSource> on a task. Note that only the shorter of the two timeouts will apply.
21762176
2177+
## Example
2178+
2179+
The following example sets the `Timeout` property.
2180+
2181+
```csharp
2182+
HttpClient httpClient = new HttpClient();
2183+
httpClient.Timeout = TimeSpan.FromMinutes(10);
2184+
```
2185+
21772186
]]></format>
21782187
</remarks>
21792188
<exception cref="T:System.ArgumentOutOfRangeException">The timeout specified is less than or equal to zero and is not <see cref="F:System.Threading.Timeout.InfiniteTimeSpan" />.</exception>

0 commit comments

Comments
 (0)