Skip to content

Commit 9dec8bc

Browse files
authored
Bigboybamo patch 7 (#43626)
* Update access-modifiers.md Added description for file access type modifier * Update snippet8003.fs
1 parent 7f6ab0a commit 9dec8bc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

samples/snippets/fsharp/lang-ref-2/snippet8003.fs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
open System.Net
22
open Microsoft.FSharp.Control.WebExtensions
3+
open System.Net.Http
34

45
let urlList = [ "Microsoft.com", "http://www.microsoft.com/"
56
"MSDN", "http://msdn.microsoft.com/"
@@ -10,8 +11,8 @@ let fetchAsync(name, url:string) =
1011
async {
1112
try
1213
let uri = new System.Uri(url)
13-
let webClient = new WebClient()
14-
let! html = webClient.AsyncDownloadString(uri)
14+
let httpClient = new HttpClient()
15+
let! html = httpClient.GetStringAsync(uri) |> Async.AwaitTask
1516
printfn "Read %d characters for %s" html.Length name
1617
with
1718
| ex -> printfn "%s" (ex.Message);
@@ -24,4 +25,4 @@ let runAll() =
2425
|> Async.RunSynchronously
2526
|> ignore
2627

27-
runAll()
28+
runAll()

0 commit comments

Comments
 (0)