Skip to content

Commit

Permalink
Update WebClient references to HttpClient in F# asynchronous programm…
Browse files Browse the repository at this point in the history
…ing documentation (#43794)

* Fixed bug 43744.

* Fixed warnings.

---------

Co-authored-by: Adit Sheth <[email protected]>
  • Loading branch information
shethaadit and Adit Sheth authored Dec 2, 2024
1 parent 33c6727 commit 6878d72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/fsharp/language-reference/async-expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ In addition to `let!`, you can use `use!` to perform asynchronous bindings. The

## Asynchronous Primitives

A method that performs a single asynchronous task and returns the result is called an *asynchronous primitive*, and these are designed specifically for use with `let!`. Several asynchronous primitives are defined in the F# core library. Two such methods for Web applications are defined in the module [`FSharp.Control.WebExtensions`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-webextensions.html): [`WebRequest.AsyncGetResponse`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-webextensions.html#AsyncGetResponse) and [`WebClient.AsyncDownloadString`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-webextensions.html#AsyncDownloadString). Both primitives download data from a Web page, given a URL. `AsyncGetResponse` produces a `System.Net.WebResponse` object, and `AsyncDownloadString` produces a string that represents the HTML for a Web page.
A method that performs a single asynchronous task and returns the result is called an *asynchronous primitive*, and these are designed specifically for use with `let!`. Several asynchronous primitives are defined in the F# core library. Two such methods for Web applications are defined in the module [`FSharp.Control.WebExtensions`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-webextensions.html): [`WebRequest.AsyncGetResponse`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-webextensions.html#AsyncGetResponse) and [`HttpClient.GetStringAsync`](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getstringasync) (wrapped with `Async.AwaitTask` for compatibility with F#'s asynchronous model). Both primitives download data from a Web page, given a URL. `AsyncGetResponse` produces a `System.Net.WebResponse` object, and `GetStringAsync` produces a string that represents the HTML for a Web page.

Several primitives for asynchronous I/O operations are included in the [`FSharp.Control.CommonExtensions`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-commonextensions.html) module. These extension methods of the `System.IO.Stream` class are [`Stream.AsyncRead`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-commonextensions.html#AsyncRead) and [`Stream.AsyncWrite`](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-control-commonextensions.html#AsyncWrite).

Expand Down

0 comments on commit 6878d72

Please sign in to comment.