File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
samples/snippets/fsharp/lang-ref-2 Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11open System.Net
22open Microsoft.FSharp .Control .WebExtensions
3+ open System.Net .Http
34
45let 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()
You can’t perform that action at this time.
0 commit comments